It has reached me that the Messenger of Allah ﷺ said, "There is no person who sits in a gathering and then says, when he intends to rise, 'Glory be to You, O Allah, and praise be to You. There is no god but You. I seek Your forgiveness and turn to You in repentance,' except that he is forgiven for whatever occurred in that gathering."
بلغني أن رسول الله ﷺ قال: ما من إنسان يكون في مجلس فيقول حين يريد أن يقوم: سبحانك اللهم وبحمدك لا إله إلا أنت، أستغفرك، وأتوب إليك إلا غفر له ما كان في ذلك المجلس.
Ahmad (15729), Tahawi in Sharh Maani (4/289), and Tabarani in al-Kabir (7/183) all narrated it through various routes from Layth (that is, Ibn Saad), from Yazid bin Had, from Ismail bin Abdullah bin Jafar, who mentioned it.This is mursal, but the other chain to which Yazid bin Had alluded is connected and sahih. Ibn Hajar declared it sahih, saying in Nukat (2/732), "Its narrators are reliable and firmly established, and Saaib's hearing from the Prophet ﷺ has indeed been established as sahih, so the hadith is sahih." End quote.