The Messenger of Allah ﷺ would go without fasting in a month until we thought he would not fast at all that month, and he would fast until we thought he would not break his fast at any point in it. And during the night, you would not wish to see him praying except that you saw him doing so, nor sleeping except that you saw him doing so.
كان رسول الله ﷺ يفطر من الشهر حتى نظن أن لا يصوم منه، ويصوم حتى نظن أن لا يفطر منه شيئا، وكان لا تشاء تراه من الليل مصليا إلا رأيته، ولا نائما إلا رأيته.
Bukhari narrated it in the Book of Fasting (1972) via Humayd, that he heard Anas, and so on.Muslim narrated it in the Book of Fasting (1158) via Thabit, from Anas, "The Messenger of Allah ﷺ used to fast until it was said, 'He has been fasting, he has been fasting.' And he would break his fast until it was said, 'He has broken his fast, he has broken his fast.'"