The Messenger of Allah ﷺ said, "Each of you remains in prayer as long as he is waiting for the prayer, and the angels keep praying for any of you as long as he is in the mosque, saying, 'Allah, forgive him. Allah, have mercy on him.'"
حدثنا عبد الرزاق حدثنا معمر عن أيوب عن ابن سيرين
قال رسول الله ﷺ لا يزال أحدكم في صلاة ما كان ينتظر الصلاة ولا تزال الملائكة تصلي على أحدكم ما كان في مسجد تقول اللهم اغفر له اللهم ارحمه
Its isnad is sahih. Muslim 1:184 narrated it with similar wording, from Sufyan, from Ayub, from Ibn Sirin, from Abu Hurairah. Its meaning has already appeared through another route, within hadith 7424, and see also 7042.