Abu Hurairah reported,

The Messenger of Allah ﷺ said, "When the imam says, 'Allah hears whoever praises Him,' say, 'O Allah, our Lord, to You belongs all praise.' Whoever's words coincide with the words of the angels will have his past sins forgiven."

Bukhari 3228

Sahih

حدثنا إسماعيل قال حدثني مالك عن سمي عن أبي صالح

عن أبي هريرة رضي الله عنه

أن رسول الله ﷺ قال إذا قال الإمام سمع الله لمن حمده فقولوا اللهم ربنا لك الحمد فإنه من وافق قوله قول الملائكة غفر له ما تقدم من ذنبه

البخاري 3228صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Beginning of creation
Chapter
If one of you says Ameen and the angels in heaven say it, and one coincides with the other, his previous sins will be forgiven
Numbering
Darussalam 3228
Bukhari 3228