Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
ibnmajah:1217Sufyān b. Wakīʿ > Yūnus b. Bukayr > Ibn Isḥāq > Salamah b. Ṣafwān b. Salamah > Abū Salamah > Abū Hurayrah

“The Satan comes between the son of Adam and his soul, and he does not know how many Rak’ah he has prayed. If a person notices that, then let him prostrate twice before he says the Salam.”  

ابن ماجة:١٢١٧حَدَّثَنَا سُفْيَانُ بْنُ وَكِيعٍ حَدَّثَنَا يُونُسُ بْنُ بُكَيْرٍ حَدَّثَنَا ابْنُ إِسْحَاقَ أَخْبَرَنِي سَلَمَةُ بْنُ صَفْوَانَ بْنِ سَلَمَةَ عَنْ أَبِي سَلَمَةَ عَنْ أَبِي هُرَيْرَةَ

أَنَّ النَّبِيَّ ﷺ قَالَ إِنَّ الشَّيْطَانَ يَدْخُلُ بَيْنَ ابْنِ آدَمَ وَبَيْنَ نَفْسِهِ فَلاَ يَدْرِي كَمْ صَلَّى فَإِذَا وَجَدَ ذَلِكَ فَلْيَسْجُدْ سَجْدَتَيْنِ قَبْلَ أَنْ يُسَلِّمَ  


See similar narrations below:

Collected by Ibn Mājah
ibnmajah:1216Sufyān b. Wakīʿ > Yūnus b. Bukayr > Ibn Isḥāq > al-Zuhrī > Abū Salamah > Abū Hurayrah

“The Satan comes to any one of you while he is praying and comes between him and his soul, until he does not know whether he as added something or omitted something. If that happens, then he should prostrate twice before the Salam, then he should say the Salam.”  

ابن ماجة:١٢١٦حَدَّثَنَا سُفْيَانُ بْنُ وَكِيعٍ حَدَّثَنَا يُونُسُ بْنُ بُكَيْرٍ حَدَّثَنَا ابْنُ إِسْحَاقَ حَدَّثَنِي الزُّهْرِيُّ عَنْ أَبِي سَلَمَةَ عَنْ أَبِي هُرَيْرَةَ

أَنَّ النَّبِيَّ ﷺ قَالَ إِنَّ الشَّيْطَانَ يَأْتِي أَحَدَكُمْ فِي صَلاَتِهِ فَيَدْخُلُ بَيْنَهُ وَبَيْنَ نَفْسِهِ حَتَّى لاَ يَدْرِي زَادَ أَوْ نَقَصَ فَإِذَا كَانَ ذَلِكَ فَلْيَسْجُدْ سَجْدَتَيْنِ قَبْلَ أَنْ يُسَلِّمَ ثُمَّ يُسَلِّمْ