Ata bin Yasar reported,

The Messenger of Allah ﷺ said, "When one of you is uncertain about his prayer and does not know how many units he has prayed, three or four, let him pray one more unit and perform two prostrations while seated before the closing salutation. If the unit he prayed was a fifth, these two prostrations will pair it, and if it was the fourth, the two prostrations will be a humiliation for Satan."

Abu Dawud 1026

Sahih

حدثنا القعنبي عن مالك عن زيد بن أسلم

عن عطاء بن يسار

أن رسول الله ﷺ قال إذا شك أحدكم في صلاته فلا يدري كم صلى ثلاثا أو أربعا فليصل ركعة وليسجد سجدتين وهو جالس قبل التسليم فإن كانت الركعة التي صلى خامسة شفعها بهاتين وإن كانت رابعة فالسجدتان ترغيم للشيطان

أبو داود 1026صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Abu Dawud
Book
Prayer
Chapter
If uncertain between two and three, one who says to disregard the doubt
Numbering
Darussalam 1026
Abu Dawud 1026