Sunan An-Nasa'i - سنن النسائي
13. The Book of Forgetfulness (In Prayer) - كتاب السهو
25) Chapter: Estimating (what is most likely the case)
It was narrated 'Abdullah bin Ja'far that :
The Messenger of Allah (ﷺ) said: "Whoever has doubt during his prayer, let him prostrate twice after he said the taslim."
25) باب التَّحَرِّي
أَخْبَرَنَا مُحَمَّدُ بْنُ هَاشِمٍ، أَنْبَأَنَا الْوَلِيدُ، أَنْبَأَنَا ابْنُ جُرَيْجٍ، عَنْ عَبْدِ اللَّهِ بْنِ مُسَافِعٍ، عَنْ عُتْبَةَ بْنِ مُحَمَّدِ بْنِ الْحَارِثِ، عَنْ عَبْدِ اللَّهِ بْنِ جَعْفَرٍ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ . " مَنْ شَكَّ فِي صَلاَتِهِ فَلْيَسْجُدْ سَجْدَتَيْنِ بَعْدَ التَّسْلِيمِ "