Abu Barza reported,

The Messenger of Allah ﷺ used to say toward the end of his life, whenever he wished to rise from a gathering, "Glory be to You, Allah, and praise be to You. I bear witness that there is no god but You. I seek Your forgiveness and turn to You in repentance."A man said, "Messenger of Allah, you are saying words that you did not used to say before."He replied, "It is an expiation for whatever may have occurred in the gathering."

Azami 10790

Hasan

عن أبي برزة الأسلمي قال

كان رسول الله ﷺ يقول بأخرة إذا أراد أن يقوم من المجلس: سبحانك اللهم وبحمدك أشهد أن لا إله إلا أنت، أستغفرك وأتوب إليك. فقال رجل يا رسول الله: إنك لتقول قولا ما كنت تقوله فيما مضى قال: كفارة لما يكون في المجلس.

الأعظمي 10790حسن
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Supplications, remembrances, and prayer upon the chosen Prophet ﷺ
Chapter
Supplications
Section
What to say when getting up from one's gathering
Numbering
Jami al-Kamil 10790 (2nd edition)
Azami 10790