The Messenger of Allah ﷺ would fast until we said he would never break his fast, and he would go without fasting until we said he did not intend to fast at all. He never fasted an entire month consecutively, other than Ramadan, from the time he arrived in Medina.
أخبرنا محمد بن بشار قال حدثنا محمد قال حدثنا شعبة عن أبي بشر عن سعيد بن جبير
كان رسول الله ﷺ يصوم حتى نقول لا يفطر ويفطر حتى نقول ما يريد أن يصوم وما صام شهرا متتابعا غير رمضان منذ قدم المدينة
Muslim narrated it in the Book of Fasting, chapter on the Prophet's ﷺ fasting outside of Ramadan, etc., hadith no. 1157, from Muhammad bin Bashshar Bundar, and Bukhari, in the Book of Fasting, chapter on what is mentioned regarding the Prophet's fasting and breaking his fast, hadith no. 1971, from the hadith of Abu Bishr Jafar bin Abu Wahshiya through him, and it is also in Al-Kubra, hadith no. 2655.