Abu Saeed Khudri reported,

The Messenger of Allah ﷺ said, "When one of you is uncertain about his prayer and does not know how many he has prayed, three or four, he should discard the doubt and build upon what he is certain of, then perform two prostrations before giving the salutation. If he had prayed five, they will make his prayer an even number."Musa once said, "If he had prayed five, they will make his prayer even for him, and if he had completed four, the two prostrations will be a humiliation for Satan."

Ahmad 11782

Sahih

حدثنا موسى بن داود حدثنا سليمان بن بلال عن زيد بن أسلم عن عطاء بن يسار

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

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

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