وَعَنْ أَبِي هُرَيْرَةَ رَضِيَ اللَّهُ عَنْهُ قَالَ: قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: " إِذَا قَالَ الْإِمَامُ: سَمِعَ اللَّهُ لِمَنْ حَمِدَهُ فَقُولُوا: اللَّهُمَّ رَبَّنَا لَكَ الْحَمْدُ فَإِنَّهُ مَنْ وَافَقَ قَوْلُهُ قَوْلَ الْمَلَائِكَةِ غُفِرَ لَهُ مَا تقدم من ذَنبه "

When the imam says, “God listens to him who praises Him,” say, “O God, our Lord, to Thee be the praise for if what anyone says synchronises with what the angels say, he will be forgiven his past sins.

(Bukhari and Muslim.)