Question:
Someone intended to observe voluntary fasting. Before the Fajr Athaan (call to prayer), he put some food in his mouth then fell asleep. When he woke up, after the Athaan, the food was still in his mouth, and so he spat it out immediately and continued fasting. Was his fasting valid?
Answer:
All perfect praise be to Allah, the Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His Slave and Messenger.
Fasting in such a state is valid as long as the food did not go beyond the mouth and enter the stomach, i.e. it simply remained in the mouth as mentioned in the question. The fast is not broken unless food reaches the stomach. Food that remains only in the mouth for some time does not break the fast.
Both voluntary and obligatory fasting are the same as to what breaks the fast and what is excusable. There is no difference between the matters that break obligatory fasting and those which break voluntary fasting. However, a difference is that it is not incumbent to complete voluntary fast or make up for it if broken before sunset, according to the most predominant opinion of scholars.
Allah Knows best.