Sahih al-Bukhari, Volume 4, Book 55, Hadith 630 (USC-MSA) ⓘ
Narrated `Abdullah bin `Amr bin Al-As: The Prophet said to me, "I have been informed that you pray all the nights and observe fast all the days; is this true?" I replied, "Yes." He said, "If you do so, your eyes will become weak and you will get bored. So fast three days a month, for this will be the fasting of a whole year, or equal to the fasting of a whole year." I said, "I find myself able to fast more." He said, "Then fast like the fasting of (the Prophet) David who used to fast on alternate days and would not flee on facing the enemy."
حَدَّثَنَا خَلاَّدُ بْنُ يَحْيَى، حَدَّثَنَا مِسْعَرٌ، حَدَّثَنَا حَبِيبُ بْنُ أَبِي ثَابِتٍ، عَنْ أَبِي الْعَبَّاسِ، عَنْ عَبْدِ اللَّهِ بْنِ عَمْرِو بْنِ الْعَاصِ، قَالَ قَالَ لِي رَسُولُ اللَّهِ صلى الله عليه وسلم " أَلَمْ أُنَبَّأْ أَنَّكَ تَقُومُ اللَّيْلَ وَتَصُومُ ". فَقُلْتُ نَعَمْ. فَقَالَ " فَإِنَّكَ إِذَا فَعَلْتَ ذَلِكَ هَجَمَتِ الْعَيْنُ وَنَفِهَتِ النَّفْسُ، صُمْ مِنْ كُلِّ شَهْرٍ ثَلاَثَةَ أَيَّامٍ، فَذَلِكَ صَوْمُ الدَّهْرِ ـ أَوْ كَصَوْمِ الدَّهْرِ ". قُلْتُ إِنِّي أَجِدُ بِي ـ قَالَ مِسْعَرٌ يَعْنِي ـ قُوَّةً. قَالَ " فَصُمْ صَوْمَ دَاوُدَ ـ عَلَيْهِ السَّلاَمُ ـ وَكَانَ يَصُومُ يَوْمًا، وَيُفْطِرُ يَوْمًا، وَلاَ يَفِرُّ إِذَا لاَقَى ".
also referenced under: Book 60, Hadith 91 (In-Book) & Hadith 3419 (DarusSalam)