The Messenger of Allah ﷺ said, "The most beloved fasting to Allah is the fasting of Dawud, for he used to fast one day and break his fast the next. And the most beloved prayer to Allah is the prayer of Dawud. He used to sleep for half the night, pray for a third of it, and sleep for a sixth of it."
حدثنا أبو إسحق الشافعي إبراهيم بن محمد بن العباس حدثنا سفيان بن عيينة عن عمرو بن دينار قال سمعت عمرو بن أوس قال سمعت
قال رسول الله ﷺ أحب الصيام إلى الله صيام داود فإنه كان يصوم يوما ويفطر يوما وأحب الصلاة إلى الله عز وجل صلاة داود كان ينام نصف الليل ويصلي ثلثه وينام سدسه
Bukhari narrated it in tahajjud, chapter on one who sleeps at dawn, no. 1131, 3420, and Muslim, etc., no. 1160/189, from the hadith of Sufyan, similarly. Fasting, chapter on the prohibition of fasting continuously for one who is harmed by it.