عَنْ أَبِي هُرَيْرَةَ رَضِيَ اللَّهُ عَنْهُ يَبْلُغُ بِهِ النَّبِيَّ صَلَّى اللَّهُ عَلَيْهِ وَآلِهِ وَسَلَّمَ: ((يَأْتِي أَحَدَكُمُ الشَّيْطَانُ وَهُوَ فِي صَلَاتِهِ فَيُلَبِّسُ عَلَيْهِ حَتَّى لَا يَدْرِي كَمْ صَلَّى فَمَنْ وَجَدَ مِنْ ذَلِكَ شَيْئًا فَلْيَسْجُدْ سَجْدَتَيْنِ وَهُوَ جَالِسٌ))
It is narrated from Sayyiduna Abu Hurairah, may Allah be pleased with him, that the Noble Prophet, peace and blessings be upon him, said: When any one of you is in prayer, Satan comes to him and confuses his prayer to such an extent that he does not even know how much he has prayed. So, whoever finds himself in such a situation should perform two prostrations while he is sitting.