Allah's Messenger said: "When the Imam says: (Sami Allahu liman hamidah) 'Allah listens to those who praise Him. Then (all of you) say: (Rabbana wa lakal-hamd) 'O our Lord! And to You is the praise for whoever's saying concurs with the saying of the angels, then his past sins will be forgiven."
Jami` at-Tirmidhi Book 2, Hadith 119