The Messenger of Allah ﷺ said, "When the imam says, 'Allah hears the one who praises Him,' say, 'Our Lord, to You be all praise.' For whoever's words coincide with the words of the angels will have his past sins forgiven."
حدثنا إسحق بن موسى الأنصاري حدثنا معن حدثنا مالك عن سمي عن أبي صالح
أن رسول الله ﷺ قال إذا قال الإمام سمع الله لمن حمده فقولوا ربنا ولك الحمد فإنه من وافق قوله قول الملائكة غفر له ما تقدم من ذنبه
Agreed upon [by Bukhari and Muslim]. Bukhari reported it in the Book of Adhan, Chapter on the Merit of "O Allah, our Lord, to You belongs praise," Hadith 796, and Muslim, Hadith 407, from the hadith of Malik through this same chain, and it is found in the Muwatta, 1/88 (Yahya).Statement of Ibn Sirin.