Toward the end of his life, whenever the Messenger of Allah ﷺ sat in a gathering and wished to rise, he would say, "Glory be to You, Allah, and praise. I bear witness that there is no god but You. I seek Your forgiveness and turn to You in repentance."The companions said, "Messenger of Allah, you now say words that you did not say before."He replied, "This is an expiation for whatever occurs in the gathering."
حدثنا يعلى حدثنا الحجاج بن دينار عن أبي هاشم عن رفيع أبي العالية
لما كان بآخرة كان رسول الله ﷺ إذا جلس في المجلس فأراد أن يقوم قال سبحانك اللهم وبحمدك أشهد أن لا إله إلا أنت أستغفرك وأتوب إليك فقالوا يا رسول الله إنك تقول الآن كلاما ما كنت تقوله فيما خلا قال هذا كفارة ما يكون في المجلس
Its isnad is sahih. Hajjaj bin Dinar is trustworthy, and his hadith appears in the Four (Sunan). Abu Hashim is Rumani Wasiti, and Rafi is Ibn Mihran, Abu Aliyah, both of whom are reliable. The hadith has already appeared at 19657.