The Prophet ﷺ used to perform the witr prayer with thirteen rakahs. When he grew older and became weaker, he performed witr with seven.
حدثنا هناد حدثنا أبو معاوية عن الأعمش عن عمرو بن مرة عن يحيى بن الجزار
كان النبي ﷺ يوتر بثلاث عشرة ركعة فلما كبر وضعف أوتر بسبع
[Sahih] Nasai also narrated it, 3/237-238, hadith no. 1709 (Qiyam al-Layl, chapter on mentioning the differences regarding Habib bin Abu Thabit... etc.) from the hadith of Abu Muawiya al-Darir through him, and Hakim graded it sahih according to the criteria of the two sheikhs, 1/306, and Dhahabi agreed with him. The hadith has many corroborating narrations in Muslim (746) and elsewhere.There is also a narration on this subject from Ayesha [Bukhari, hadith no. 1139, and Muslim, hadith no. 746].