Mughira bin Shuba reported,

When he had prayed two rakahs, he stood up without sitting. Those behind him said tasbih to alert him, but he gestured to them to stand. When he finished his prayer, he gave the salam, then performed the two prostrations of forgetfulness, gave the salam again, and said, "This is how the Messenger of Allah ﷺ did it."

Tirmidhi 365

Hasan

حدثنا عبد الله بن عبد الرحمن أخبرنا يزيد بن هارون عن المسعودي عن زياد بن علاقة قال صلى بنا

المغيرة بن شعبة

فلما صلى ركعتين قام ولم يجلس فسبح به من خلفه فأشار إليهم أن قوموا فلما فرغ من صلاته سلم وسجد سجدتي السهو وسلم وقال هكذا صنع رسول الله ﷺ

الترمذي 365حسن
Contents
Reference
Commentary
Ayat
Collection
Jami Tirmidhi
Book
Prayer
Chapter
Imam stands up after two rakas forgetfully
Numbering
Darussalam 365
Tirmidhi 365