Sunnah.com : Book 5, Hadith 19
Narration text is preserved in its supplied Arabic and English. Translated interfaces and reading guides do not add narration translations in other languages.
من جلس في مجلس، فكثر فيه لغطه فقال قبل أن يقوم من مجلسه ذلك: سبحانك اللهم وبحمدك، أشهد أن لا إله إلا أنت، أستغفرك وأتوب إليك، إلا غفر له ما كان في مجلسه ذلك"
Abu Hurairah (May Allah be pleased with him) reported:
Messenger of Allah (ﷺ) said, "Whoever sits in a gathering and indulges in useless talk and before getting up supplicates: 'Subhanaka Allahumma wa bihamdika, ash-hadu an la ilaha illa Anta, astaghfiruka wa atubu ilaika (O Allah, You are free from every imperfection; praise be to You. I testify that there is no true god except You; I ask Your Pardon and turn to You in repentance),' he will be forgiven for (the sins he may have intentionally or unintentionally committed) in that assembly." [At-Tirmidhi].
Full reference and source
Sunnah.com : Book 5, Hadith 19 Arabic/English book : Book 5, Hadith 832
View source on Sunnah.com (opens in a new tab)