The Messenger of Allah ﷺ ended the prayer after two units.Dhul-Yadayn said to him, "Has the prayer been shortened, or did you forget, 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 the remaining two units, then gave the closing salutation. Then he said the takbir and made a prostration like his usual prostration, or longer. Then he raised his head, then prostrated again like his usual prostration, or longer. Then he raised his head.
أخبرنا محمد بن سلمة قال حدثنا ابن القاسم عن مالك قال حدثني أيوب عن محمد بن سيرين
أن رسول الله ﷺ انصرف من اثنتين فقال له ذو اليدين أقصرت الصلاة أم نسيت يا رسول الله فقال رسول الله ﷺ أصدق ذو اليدين فقال الناس نعم فقام رسول الله ﷺ فصلى اثنتين ثم سلم ثم كبر فسجد مثل سجوده أو أطول ثم رفع رأسه ثم سجد مثل سجوده أو أطول ثم رفع
Bukhari transmitted it in the Book of Adhan, chapter, "Should the imam rely on what the people say if he is in doubt?" hadith 714, from the hadith of Malik, and Muslim, hadith 573 (see the previous hadith), from the hadith of Ayub with the same wording. It is also found in Muwatta (Yahya), 1/93, and in Kubra, hadith 1148.