Jami` at-Tirmidhi 267
Grading supplied with this record: Sahih (Darussalam)
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 narrated that :
Allah's Messenger said: "When the Imam says: (Sami Allahu liman hamidah) 'Allah listens to those who praise Him. Then (all of you) say: (Rabbana wa lakal-hamd) 'O our Lord! And to You is the praise for whoever's saying concurs with the saying of the angels, then his past sins will be forgiven."
Full reference and source
Jami` at-Tirmidhi 267 In-book : Book 2, Hadith 119 English translation : Vol. 1, Book 2, Hadith 267
View source on Sunnah.com (opens in a new tab)