He stood up after the second rakah, and the congregation said tasbih to alert him, but he signaled tasbih back to them. When he had completed the rest of his prayer, he gave the salam, then performed the two prostrations of forgetfulness while seated. Afterward he told them that the Messenger of Allah ﷺ had done with his companions just as he had done with them.
حدثنا أحمد بن منيع حدثنا هشيم أخبرنا ابن أبي ليلى عن الشعبي قال صلى بنا
فنهض في الركعتين فسبح به القوم وسبح بهم فلما صلى بقية صلاته سلم ثم سجد سجدتي السهو وهو جالس ثم حدثهم أن رسول الله ﷺ فعل بهم مثل الذي فعل
[Hasan] Ahmad also narrated it (4/248) through the hadith of Muhammad bin Abdul-Rahman bin Abu Layla using this chain, and he is daif. His hadith has corroborating narrations in Tahawi's Maani Athar (1/440).On this topic there is also a report from Uqba bin Amir [Tabarani, as in Tuhfat Ahwadhi 1/290], Saad bin Abu Waqqas [Abu Yaala, no. 759, 785], and Abdullah bin Buhaina [Bukhari, no. 829, and Muslim, no. 570].The hadith of Sufyan Thawri from Jabir Jafi was narrated by Abu Dawud, no. 1036.