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

It was narrated from Abu Hurairah that: The Messenger of Allah (PBUH) said: "When the Imam says: 'Sami Allahu liman hamidah (Allah hears the one who praises Him),' then say: 'Rabbana wa lakal-hamd,' (Our Lord, and to You be the praise).' Whoever says that and it coincides with the angels saying it, his previous sins will be forgiven." Translation Not Available

Book Ref: Sunan An Nisai Book 12 Hadith 1063
Web Ref:  Sunan An Nisai Vol 2 Book 12 Hadith 1064