Mishkat al-Masabih 874
Abu Huraira reported God’s Messenger as saying:
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.)
وَعَنْ أَبِي هُرَيْرَةَ رَضِيَ اللَّهُ عَنْهُ قَالَ: قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: 
" إِذَا قَالَ الْإِمَامُ: سَمِعَ اللَّهُ لِمَنْ حَمِدَهُ فَقُولُوا: اللَّهُمَّ رَبَّنَا لَكَ الْحَمْدُ فَإِنَّهُ مَنْ وَافَقَ قَوْلُهُ قَوْلَ الْمَلَائِكَةِ غُفِرَ لَهُ مَا تقدم من ذَنبه "