عَن طلحةَ بنِ عبيدِ اللَّهِ أَنَّ النَّبِيَّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ كَانَ إِذَا رَأَى الْهِلَالَ قَالَ: «اللَّهُمَّ أَهِلَّهُ عَلَيْنَا بِالْأَمْنِ وَالْإِيمَانِ وَالسَّلَامَةِ وَالْإِسْلَامِ رَبِّي وَرَبُّكَ اللَّهُ» . رَوَاهُ التِّرْمِذِيُّ. وَقَالَ: هَذَا حَدِيثٌ حَسَنٌ غَرِيبٌ
Translation

Abu Huraira reported God’s messenger as saying that if anyone sits in an assembly where there is much clamour* and says before getting up to leave, “Glory be to Thee, O God, and I begin with praise of Thee; I testify that there is no god but Thou; I ask Thy pardon and turn to Thee in repentance,” he will be forgiven for what took place in that assembly where he was. *Or, ‘wicked talk,’ or, 'meaningless talk'Tirmidhi and Baihaqi in [Kitab] ad-Da'awat al-kabir, transmitted it.