The Messenger of Allah ﷺ said to him, "Fast one day and break your fast the next. That is the fasting of Dawud, and it is the most balanced form of fasting. There is none better than that."
قال له رسول الله ﷺ: صم يوما وأفطر يوما، وذلك صيام داود. وهو أعدل الصيام لا أفضل من ذلك.
Bukhari narrated it in the chapters on the prophets (3418), and Muslim in the book of fasting (1159: 181), both from the hadith of Ibn Shihab, who said, Saeed bin Musayab and Abu Salama bin Abdul-Rahman informed me that Abdullah bin Amr said (then he mentioned it).