The Prophet ﷺ said, "When you are in prayer and you become uncertain whether you have prayed three or four units, and your stronger sense is that it was four, recite the tashahhud, then perform two prostrations while seated before giving the salam, then recite the tashahhud again, then give the salam."
حدثنا محمد بن سلمة عن خصيف
عن النبي ﷺ قال إذا كنت في الصلاة فشككت في ثلاث وأربع وأكثر ظنك على أربع تشهدت ثم سجدت سجدتين وأنت جالس قبل أن تسلم ثم تشهدت أيضا ثم سلمت
Its chain is daif because of a break in the transmission. Abu Dawud narrated it, 1:394-395, from Nufayli, from Muhammad bin Salama, from Khaseef, then Abu Dawud said, Ahmad also narrated it from Khaseef without raising it to the Prophet. Abdul-Wahid was also matched by Sufyan, Sharik, and Israil, though they differed regarding the wording of the text of the hadith, and none of them attributed it to the Prophet. Following this will come a narration from Muhammad bin Fudayl, from Khaseef, also unattributed to the Prophet.Munziri said, number 987, Nasai also recorded it. It has already been established that Abu Ubayda did not hear directly from his father.