The Messenger of Allah ﷺ said, "The most beloved fasting to Allah is the fasting of Dawud
. He would fast one day and break his fast the next. And the most beloved prayer to Allah is the prayer of Dawud. He would sleep for half the night, stand in prayer for a third of it, and sleep for a sixth of it."
أخبرنا قتيبة قال حدثنا سفيان عن عمرو بن دينار عن عمرو بن أوس أنه سمع
قال رسول الله ﷺ أحب الصيام إلى الله عز وجل صيام داود عليه السلام كان يصوم يوما ويفطر يوما وأحب الصلاة إلى الله صلاة داود كان ينام نصف الليل ويقوم ثلثه وينام سدسه
Bukhari narrated it in the Book of the Prophets, chapter "The prayer most beloved to Allah is the prayer of Dawud," hadith 3420, from Qutayba, and Muslim narrated it in the Book of Fasting, chapter "The prohibition of fasting continuously for one who is harmed by it," hadith 189/1159, from the hadith of Sufyan bin Uyayna, with the same wording. It is also found in Al-Kubra, hadith 1327.