"The Messenger of Allah (ﷺ) said the salam then he performed two prostrations of forgetfulness while he was still sitting, then he said the salam." He said: He mentioned it in the hadith of Dhul-Yadain.
The Prophet (ﷺ) prayed three (rak'ahs) then said the taslim. Al-Khirbaq said: "You prayed three." So he led them in praying the remaining rak'ah, then he said the taslim, then he did the two prostrations of forgetfulness, then he said the taslim (again).
"I watched the Messenger of Allah (ﷺ) when he prayed, and I noticed that his standing, his bowing, his standing up after bowing, his prostration, his sitting between the two prostrations and his sitting between the taslim and departing were almost the same in length."
أَخْبَرَنَا مُحَمَّدُ بْنُ سَلَمَةَ، قَالَ حَدَّثَنَا ابْنُ وَهْبٍ، عَنْ يُونُسَ، قَالَ ابْنُ شِهَابٍ أَخْبَرَتْنِي هِنْدُ بِنْتُ الْحَارِثِ الْفِرَاسِيَّةُ، أَنَّ أُمَّ سَلَمَةَ، أَخْبَرَتْهَا أَنَّ النِّسَاءَ فِي عَهْدِ رَسُولِ اللَّهِ صلى الله عليه وسلم كُنَّ إِذَا سَلَّمْنَ مِنَ الصَّلاَةِ قُمْنَ وَثَبَتَ رَسُولُ اللَّهِ صلى الله عليه وسلم وَمَنْ صَلَّى مِنَ الرِّجَالِ مَا شَاءَ اللَّهُ فَإِذَا قَامَ رَسُولُ اللَّهِ صلى الله عليه وسلم قَامَ الرِّجَالُ .
Umm Salamah told her that during the time of the Messenger of Allah (ﷺ), when the women said the taslim at the end of the prayer, the Messenger of Allah (ﷺ) and the men who had prayed with him would stay put for as long as Allah (ﷺ) willed. Then, when the Messenger of Allah (ﷺ) got up, the men did too.
When he finished the prayer, the Messenger of Allah (ﷺ) would pray for forgiveness three times and say: 'Allahumma anta asalam, wa minka as-salam tabarakta ya dhal-jalali wal-ikram (O Allah, You are the source of eace (or the One free from all faults) and from You comes peace, blessed are You, O Possessor of Majesty and Honor)."
After saying the taslim the Messenger of Allah (ﷺ) would say: "Allahumma anta as-salam wa minka as-salam tabarakta ya dhal-jalali wal-ikram (O Allah, You are the source of eace (or the One free from all faults) and from You comes peace, blessed are You, O Possessor of Majesty and Honor)."