It is narrated from Sayyiduna Abu Sa'id al-Khudri (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "When the imam says 'Allahu akbar' (Allah is the Greatest), say 'Allahu akbar', and when the imam says 'Sami' Allahu liman hamidah' (Allah hears the one who praises Him), say 'Rabbana wa laka al-hamd' (Our Lord, and to You belongs all praise)."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 2263