In Shrimad Bhagavat Gita Chapter 6 Verse 16, it has been forbidden;
It is stated that – Oh Arjun! This bhakti is neither successful of one who eats excessively, nor of one who does not eat at all, that is, neither this bhakti is successful of a person who keeps fasts, nor of someone who sleeps too much, nor of someone who remains awake a lot. It is completely forbidden in this verse to keep fast. Open your Gita and look in it.