Abu Huraira reported: The Messenger of Allah, peace and blessings be upon him, said, “When the Imam says, ‘Allah heard those who praise him,’ then say, ‘Our Lord, for you is praise.’ If one’s statement coincides with the statement of the angels, his previous sins will be forgiven.”
Source: Ṣaḥīḥ al-Bukhārī 763, Ṣaḥīḥ Muslim 409
Grade: Muttafaqun Alayhi (authenticity agreed upon) according to Al-Bukhari and Muslim
عَنْ أَبِي هُرَيْرَةَ رَضِيَ اللَّهُ عَنْهُ أَنَّ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ قَالَ إِذَا قَالَ الْإِمَامُ سَمِعَ اللَّهُ لِمَنْ حَمِدَهُ فَقُولُوا اللَّهُمَّ رَبَّنَا لَكَ الْحَمْدُ فَإِنَّهُ مَنْ وَافَقَ قَوْلُهُ قَوْلَ الْمَلَائِكَةِ غُفِرَ لَهُ مَا تَقَدَّمَ مِنْ ذَنْبِهِ
763 صحيح البخاري أبواب صفة الصلاة باب فضل اللهم ربنا لك الحمد
409 صحيح مسلم كتاب الصلاة باب التسميع والتحميد والتأمين