ENOfficial
It was narrated from Abu Sa’eed Al-Khudri that he heard the Messenger of Allah (ﷺ) say: “When the Imam says: ‘Sami’ Allahu liman hamidah (Allah hears those who praise Him),’ say: ‘Allahumma, Rabbana wa lakal-hamd (O Allah! O our Lord! To You is the praise).’”
Source: sunnah.com
Other translations
Arabic
حَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ، حَدَّثَنَا يَحْيَى بْنُ أَبِي بُكَيْرٍ، حَدَّثَنَا زُهَيْرُ بْنُ مُحَمَّدٍ، عَنْ عَبْدِ اللَّهِ بْنِ مُحَمَّدِ بْنِ عَقِيلٍ، عَنْ سَعِيدِ بْنِ الْمُسَيَّبِ، عَنْ أَبِي سَعِيدٍ الْخُدْرِيِّ، أَنَّهُ سَمِعَ رَسُولَ اللَّهِ ـ صلى الله عليه وسلم ـ يَقُولُ " إِذَا قَالَ الإِمَامُ سَمِعَ اللَّهُ لِمَنْ حَمِدَهُ . فَقُولُوا اللَّهُمَّ رَبَّنَا وَلَكَ الْحَمْدُ " .
sunnah.com