Word reached the Prophet ﷺ that I was fasting continuously and praying through the night. He either sent for me or I met him, and he asked, "Have I not been told that you fast without breaking your fast and that you pray all night? Fast and break your fast, pray and sleep, for your eye has a right over you, and your soul and your family have a right over you."I said, "I am strong enough for that."He said, "Then fast the fast of Dawud ."I asked, "And how was that?"He said, "He would fast one day and break his fast the next, and he would not flee when he met the enemy."I said, "Who can grant me the strength for this, Prophet of Allah?"Ata said, "I do not know how he mentioned fasting perpetually."The Prophet ﷺ said, "He has not fasted who fasts every day," saying it twice.
بلغ النبي ﷺ أني أسرد الصوم، وأصلي الليل فإما أرسل إلي وإما لقيته، فقال: ألم أخبر أنك تصوم ولا تفطر وتصلي؟ فصم وأفطر، وقم ونم، فإن لعينك عليك حظا، وإن لنفسك وأهلك عليك حظا. قال: إني لأقوى لذلك. قال: فصم صيام داود عليه السلام. قال: وكيف؟ قال: كان يصوم يوما، ويفطر يوما ولا يفر إذا لاقى. قال: من لي بهذه يا نبي الله؟ قال عطاء: لا أدري، كيف ذكر صيام الأبد. قال النبي ﷺ: لا صام من صام الدهر مرتين.
Bukhari narrated it in the Book of Fasting (1977), and Muslim in the Book of Fasting (1159:186), both from the hadith of Ibn Jurayj, who said, "I heard Ataa say that Abu Abbas the poet informed him that he heard Abdullah bin Amr bin As saying" (as mentioned above).Regarding this hadith, Khattabi said that Allah Almighty did not require His servant to worship Him through fasting alone, but rather required worship through various kinds of acts of worship. So if a person exhausted all his effort in fasting, he would fall short in the others. Therefore, moderation in fasting is preferable, so that some strength is preserved for the rest.This was indicated by his statement, peace and blessings be upon him, concerning Dawud , "He would not flee when he met the enemy," because he used to gain strength by breaking his fast for the sake of jihad. Al-Hafiz mentioned this in Fath al-Bari.