The Messenger of Allah ﷺ said, "Satan comes to one of you while he is in his prayer and confuses him until he does not know how much he has prayed. When he finds this happening, let him perform two prostrations while seated."
حدثنا عبد الرزاق وابن بكر قالا أخبرنا ابن جريج أخبرني ابن شهاب عن أبي سلمة بن عبد الرحمن
قال رسول الله ﷺ يأتي أحدكم الشيطان وهو في صلاته فيلبس عليه حتى لا يدري كم صلى فإذا وجد ذلك فليسجد سجدتين وهو جالس