It is narrated from a shaykh of the Ansar that a man entered the mosque, and the Messenger of Allah (peace and blessings be upon him) heard the sound of his shoes. When the Messenger of Allah (peace and blessings be upon him) had completed the prayer and said the salam, he asked that man: "In what state did you find us?" He said: In prostration, so I prostrated too. At this he (peace and blessings be upon him) said: "Do it like this, but do not count that prostration (as a rak'ah) until you catch the rak'ah. So when you see the imam standing, stand; when you see him bowing, bow; when you find him in prostration, prostrate; and if you see him sitting, sit too." Imam al-Bayhaqi narrated it in his Sunan through the route of Ya'la bin Ubayd, from Sufyan, and there is also a supporting narration (shahid) for this hadith from the narration of Sayyiduna Abu Hurayrah (may Allah be pleased with him), which Imam Abu Dawud narrated in his Sunan, as did other hadith scholars.
Hadith Referenceإتحاف الخيرة المهرة بزوائد المسانيد العشرة / كتاب افتتاح الصلاة / 1353
Hadith Gradingمحدثین:سكت عنه البوصيري، إسناده ضعيف؛ لإبهام الشيخ الأنصاري، ولم يذكر سماعًا من النبي ﷺ
Hadith Takhrij«مسدد، يحيى القطان، سفيان، عبد العزيز بن رفيع ثقات؛ «شيخ من الأنصار» مبهم لا تُعرف صحبته؛ وذكر البوصيري له شاهدًا من حديث أبي هريرة عند أبي داود»