Sayyiduna Abu Sa‘id Khudri (may Allah be pleased with him) narrates that the Messenger of Allah (peace and blessings be upon him) said: "When the Imam says « اللهُ أَكْبَرُ », then you say « اللهُ أَكْبَرُ ». When he says « سَمِعَ اللهُ لِمَنْ حَمِدَهُ », then you say « رَبَّنَا وَلَكَ الحَمْد »."