Al-Ilmam bi-Ahadith al-Ahkam 215
وَعَن أبي هُرَيْرَة رَضِيَ اللَّهُ عَنْه، قَالَ: " كَانَ رَسُول الله ﷺ إِذا قَامَ إِلَى الصَّلَاة يكبر حِين يقوم، ثمَّ يكبر حِين يرْكَع، ثمَّ يَقُول: سمع الله لمن حَمده، حِين يرفع صُلْبه من الرُّكُوع، ثمَّ يَقُول وَهُوَ قَائِم: رَبنَا لَك الْحَمد ". (أخرجه البُخَارِيّ) ، وَرَوَاهُ بَعضهم: " وَلَك الْحَمد ". فِي رِوَايَة أبي صَالح، عَن أبي هُرَيْرَة أَن رَسُول الله ﷺ قَالَ: " إِذا قَالَ الإِمَام: سمع الله لمن حَمده، فَقولُوا: اللَّهُمَّ رَبنَا لَك الْحَمد، فَإِنَّهُ من وَافق قَوْله قَول الْمَلَائِكَة غفر لَهُ مَا تقدم من ذَنبه ". لفظ رِوَايَة البُخَارِيّ فِيهَا ، وَفِي رِوَايَة غَيره " وَلَك ".
From Abu Hurayrah, may Allah be pleased with him, who said: "When the Messenger of Allah ﷺ stood for the prayer, he would say the takbir when he stood, then say the takbir when he bowed, then say: 'Allah hears the one who praises Him' when he raised his back from bowing, then say while standing: 'Our Lord, to You be praise.'" (Al-Bukhari reported it.) Some narrated it: "and to You be praise." In the narration of Abu Salih, from Abu Hurayrah, that the Messenger of Allah ﷺ said: "When the imam says: 'Allah hears the one who praises Him,' say: 'O Allah, our Lord, to You be praise,' for whoever's saying coincides with the saying of the angels, his past sins are forgiven." The wording of al-Bukhari's narration of it; in the narration of others: "and to You."