Abu Saeed Khudri reported,

The Prophet ﷺ said, "If one of you is uncertain during his prayer and does not know whether he has prayed three or four units, let him stand and pray one more unit." Yazid added, "So that the doubt becomes about having prayed extra." "Then let him perform two prostrations of forgetfulness. If he had prayed five, these two prostrations make his prayer an even number, and if he had prayed four, they humiliate Satan."

Ahmad 11794

Sahih

حدثنا يزيد وأبو النضر قالا أخبرنا عبد العزيز بن عبد الله بن أبي سلمة عن زيد بن أسلم عن عطاء بن يسار

عن أبي سعيد الخدري

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

أحمد 11794صحيح
Contents
Reference
Commentary
Ayat
Collection
Musnad Ahmad
Book
Abu Saeed Khudri
Numbering
Darussalam 11794
Ahmad 11794