Hadith 9401

وَقَالَ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ : " إِذَا قَالَ الْقَارِئُ : سَمِعَ اللَّهُ لِمَنْ حَمِدَهُ ، فَقَالَ مَنْ خَلْفَهُ : اللَّهُمَّ رَبَّنَا وَلَكَ الْحَمْدُ ، فَوَافَقَ قَوْلُهُ ذَلِكَ قَوْلَ أَهْلِ السَّمَاءِ : اللَّهُمَّ رَبَّنَا لَكَ الْحَمْدُ , غُفِرَ لَهُ مَا تَقَدَّمَ مِنْ ذَنْبِهِ " .
And he said: When the imam says "Sami' Allahu liman hamidah" and the follower says "Allahumma Rabbana wa lakal hamd," and his statement coincides with the "Allahumma Rabbana lakal hamd" of those in the heavens, then all his past sins will be forgiven.
Hadith Reference مسند احمد / مسند المكثرين من الصحابة / 9401
Hadith Grading حکم دارالسلام: إسنادہ صحیح ، خ : 796 ، م : 409