Hadithcore
Riyad as-Salihin, 832

Abu Barzah (May Allah be pleased with him) reported:

Towards the end of his life, Messenger of Allah (ﷺ) would supplicate before leaving an assembly thus: "Subhanaka Allahumma wa bihamdika, ash-hadu an la ilaha illa Anta, astaghfiruka wa atubu ilaika (O Allah, You are free from every imperfection; all praise is for You. I testify that there is no true god except You, I ask Your forgiveness and turn to You in repentance).'' A man once said to him: "O Messenger of Allah! You have spoken such words as you have never uttered before.'' He said, "It is an expiation of that which goes on in the assembly.'' <b>[Abu Dawud and Al-Hakim]</b>.

وعن أبى برزة رضى الله عنه قال‏:‏ كان رسول الله صلى الله عليه وسلم يقول بآخرة إذا أراد أن يقوم من المجلس‏:‏ ‏"‏سبحانك الله وبحمدك، أشهد أن لا إله إلا أنت، أستغفرك وأتوب إليك‏"‏ فقال رجل‏:‏ يا رسول الله، إنك لتقول قولاً ما كنت تقوله فيما مضى‏؟‏ قال‏:‏ ‏"‏ذلك كفارة لما يكون في المجلس‏. ‏‏(‏‏(‏رواه أبو داود‏)‏‏)‏‏.‏‏(‏‏(‏ورواه الحاكم أبو عبيد الله في ‏ ‏المستدرك‏ ‏ من رواية عائشة رضى الله عنها وقال‏:‏ صحيح بإسناد‏)‏‏)‏‏‏

References1 variant
In-Book Reference
Book 4, Hadith 20
Sharh · explanationclick to expand
<b>Guidance from the Hadiths:</b><br> 1) If a person sits in a gathering and engages in a lot of idle talk, he can expiate for that through the reported supplication. A believer should be keen to memorize this supplication, say it in gatherings, and teach it to other attendees.<br> 2) The supplication involves exaltation of Allah Almighty above any imperfection, praise Him for everything, affirmation of His divinity and oneness, and repenting to Him.<br> <br> <b>Benefit:</b><br> This supplication should also be said at the end of pious gatherings, acting like a seal, as indicated in an authentic Hadith narrated by Al-Nasā’i and reported by ‘Ā’ishah (may Allah be pleased with her): “When the Prophet (may Allah’s peace and blessings be upon him) sat in a gathering or offered a prayer, he would utter certain words. I asked him about these words and he replied: ‘If he (a person) has spoken some good words, these will be a seal for them to preserve them until the Day of Resurrection, and if he has spoken otherwise, these will be an expiation for him: Subhānak Allāhumma wa bihamdik, la ilāha illa ant, astaghfiruka wa atūbu ilayk (O Allah, glory and praise be to You. I testify that there is no god but You; I ask Your Pardon and turn to You in repentance).’”