The Prophet ﷺ said: If one of you is in doubt about his prayer, and if he is sure that he prayed three rak'ah, he should stand and complete one rak'ah along with its prostrations. Then he should sit and recite the tashahhud. When he finishes the prayer, and there remains nothing except salutation, he should make two prostrations while he is sitting and afterwards should give the salutation. The narrator then narrated the tradition similar to that of Malik. Abu Dawud said: Similarly, this tradition has been narrated by Ibn Wahb from Malik, Hafs b. Maisarah, Dawud b. Qais and Hisham b. Sa'd. But Hisham projected it to Abu Sa'id al-Khudri.
إِنَّ النَّبِيَّ ﷺ قَالَ إِذَا شَكَّ أَحَدُكُمْ فِي صَلاَتِهِ فَإِنِ اسْتَيْقَنَ أَنْ قَدْ صَلَّى ثَلاَثًا فَلْيَقُمْ فَلْيُتِمَّ رَكْعَةً بِسُجُودِهَا ثُمَّ يَجْلِسْ فَيَتَشَهَّدْ فَإِذَا فَرَغَ فَلَمْ يَبْقَ إِلاَّ أَنْ يُسَلِّمَ فَلْيَسْجُدْ سَجْدَتَيْنِ وَهُوَ جَالِسٌ ثُمَّ لْيُسَلِّمْ ثُمَّ ذَكَرَ مَعْنَى مَالِكٍ