The Prophet ﷺ said, "When one of you is uncertain about his prayer, let him discard the doubt and build upon what he is certain of. Once he is sure he has completed it, let him perform two prostrations while seated. If he had prayed five units, these two prostrations make his prayer an even number, and if he had prayed four, they serve as a humiliation to Satan."
أخبرنا يحيى بن حبيب بن عربي قال حدثنا خالد عن ابن عجلان عن زيد بن أسلم عن عطاء بن يسار
عن النبي ﷺ قال إذا شك أحدكم في صلاته فليلغ الشك وليبن على اليقين فإذا استيقن بالتمام فليسجد سجدتين وهو قاعد فإن كان صلى خمسا شفعتا له صلاته وإن صلى أربعا كانتا ترغيما للشيطان