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
Abu Asim (may Allah have mercy on him) mentioned a similar long hadith through another chain.
Abu al-Qasim (al-Tabarani) said: None narrated it from Sufyan except Abu Asim.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 2264
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: "Shall I not tell you of something by which Allah Almighty wipes out sins and increases good deeds?" The Companions (may Allah be pleased with them) said: Certainly, O Messenger of Allah (peace and blessings be upon him)! Please tell us. He (peace and blessings be upon him) said: "Performing ablution fully and well at times of difficulty, walking often to the mosques, and waiting for the next prayer after a prayer. Whoever among you leaves his house having performed ablution, prays in congregation, and then waits in the mosque for the next prayer, the angels say: 'Allahumma ighfir lahu, Allahumma irhamhu' (O Allah, forgive him; O Allah, have mercy on him). So when you stand for prayer, straighten and align your rows and do not leave gaps in between, for I see you even from behind my back. When your imam says 'Allahu akbar', say 'Allahu akbar'; when he bows, bow; and when he says 'Sami' Allahu liman hamidah', say 'Allahumma rabbana wa laka al-hamd'. The best rows of men are the first and their worst are the last, and the best rows of women are the last and their worst are the first." "O women! When the men prostrate, lower your gaze, so that your eyes do not fall upon the men's private parts because of their short (tight) lower garments."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 2265
A similar hadith is also reported through the narration of Abu Bakr al-Qattan (may Allah have mercy on him), except that in his book the words are "wa yusalli ma'a al-muslimin" (and he prays with the Muslims). The rest is the same.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 2266
It is narrated from Sayyiduna Abdullah bin Umar (may Allah be pleased with them both) that once we were praying with the Messenger of Allah (peace and blessings be upon him) when he (peace and blessings be upon him) heard a man saying: 'Allahu akbaru kabira, wal-hamdu lillahi kathira, wa subhana Allahi bukratan wa asila' (Allah is the Greatest, truly great; abundant praise of every kind is for Him; and glory be to Allah morning and evening). After the prayer, the Messenger of Allah (peace and blessings be upon him) asked: "Who said these words?" A man said: O Messenger of Allah! I said them. He (peace and blessings be upon him) said: "I marveled at them: the gates of the heavens were opened for these words." Sayyiduna Ibn Umar (may Allah be pleased with them both) said: Ever since I heard these words from the Messenger of Allah (peace and blessings be upon him), I have never abandoned them.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 2267