The Prophet ﷺ ended the prayer after two units. Dhul-Yadayn asked him, "Has the prayer been shortened, or have you forgotten, Messenger of Allah?"The Messenger of Allah ﷺ asked, "Is Dhul-Yadayn telling the truth?"The people answered, "Yes."So the Messenger of Allah ﷺ stood and prayed two more units, then gave the closing salutation. Then he said the takbir and prostrated like his usual prostration or longer, then said the takbir and rose, then prostrated like his usual prostration or longer.
حدثنا الأنصاري حدثنا معن حدثنا مالك عن أيوب بن أبي تميمة وهو أيوب السختياني عن محمد بن سيرين
أن النبي ﷺ انصرف من اثنتين فقال له ذو اليدين أقصرت الصلاة أم نسيت يا رسول الله فقال رسول الله ﷺ أصدق ذو اليدين فقال الناس نعم فقام رسول الله ﷺ فصلى اثنتين أخريين ثم سلم ثم كبر فسجد مثل سجوده أو أطول ثم كبر فرفع ثم سجد مثل سجوده أو أطول
Agreed upon (Bukhari and Muslim). Bukhari narrated it in the Book of Sahw, Chapter: One who does not recite the tashahhud in the two prostrations of sahw, no. 1228, from the hadith of Malik, and Muslim, no. 573, from the hadith of Ayub Sakhtiyani, with the same wording.On this subject there are also narrations from Imran bin Husayn [mentioned previously, no. 395], Ibn Umar [Abu Dawud, no. 1017], and Dhul-Yadayn [Abdullah bin Ahmad in the Zawaid to the Musnad, 4/77, and Bayhaqi, 2/366, 367].