Abu Huraira reported: The Messenger of Allah, peace and blessings be upon him, said, “Whoever sits in a gathering and indulges in idle talk, then says before leaving that gathering, ‘Glory be to you, O Allah, and your praises. I bear witness there is no God but you, I seek your forgiveness and repent to you,’ he will be forgiven for what happened in that gathering of his.”
Source: Sunan al-Tirmidhī 3433
Grade: Sahih (authentic) according to Al-Albani
عَنْ أَبِي هُرَيْرَةَ قَالَ قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ مَنْ جَلَسَ فِي مَجْلِسٍ فَكَثُرَ فِيهِ لَغَطُهُ فَقَالَ قَبْلَ أَنْ يَقُومَ مِنْ مَجْلِسِهِ ذَلِكَ سُبْحَانَكَ اللَّهُمَّ وَبِحَمْدِكَ أَشْهَدُ أَنْ لَا إِلَهَ إِلَّا أَنْتَ أَسْتَغْفِرُكَ وَأَتُوبُ إِلَيْكَ إِلَّا غُفِرَ لَهُ مَا كَانَ فِي مَجْلِسِهِ ذَلِكَ
3433 سنن الترمذي كتاب الدعوات باب ما يقول إذا قام من المجلس
3433 المحدث الألباني خلاصة حكم المحدث صحيح في صحيح الترمذي