A man came to the Prophet ﷺ and said, "Messenger of Allah, I prayed but I did not know whether I had prayed an even number of rakahs or an odd number."The Messenger of Allah ﷺ replied, "Beware of letting Satan toy with you in your prayer. Whoever among you prays and does not know whether he prayed an even or an odd number of rakahs, let him perform two prostrations, for they will complete his prayer."
حدثنا محمد بن عبد الله بن الزبير حدثنا مسرة بن معبد عن يزيد بن أبي كبشة
جاء رجل إلى النبي ﷺ فقال يا رسول الله إني صليت فلم أدر أشفعت أم أوترت فقال رسول الله ﷺ إياي وأن يتلعب بكم الشيطان في صلاتكم من صلى منكم فلم يدر أشفع أو أوتر فليسجد سجدتين فإنهما تمام صلاته