The Prophet ﷺ said, "If one of you is uncertain whether he has prayed three or four units, let him pray one more unit, then perform two prostrations afterward while seated. If he had in fact prayed five, these prostrations will make his prayer even, and if he had prayed four, they will be a humiliation for Satan."
أخبرنا محمد بن رافع قال حدثنا حجين بن المثنى قال حدثنا عبد العزيز وهو ابن أبي سلمة عن زيد بن أسلم عن عطاء بن يسار
عن النبي ﷺ قال إذا لم يدر أحدكم صلى ثلاثا أم أربعا فليصل ركعة ثم يسجد بعد ذلك سجدتين وهو جالس فإن كان صلى خمسا شفعتا له صلاته وإن صلى أربعا كانتا ترغيما للشيطان