Sayyiduna Wa'il bin Hujr (may Allah be pleased with him) said: The Prophet (peace and blessings be upon him) was in the prayer when someone came in and entered the prayer, and he said: "Allahu akbaru kabira, wa subhanallahi wa bihamdihi kathira (Allah is the Greatest, greatly; and glory and praise be to Allah, abundantly)." At this the Prophet of Allah (peace and blessings be upon him) raised his gaze towards the heaven, then turned back to his prayer. When he had finished the prayer, he said: "Who said that phrase?" He said: It was I, O Messenger of Allah! He (peace and blessings be upon him) said: "The gates of the heaven were opened for it, and nothing held it back short of the Throne."
Hadith Referenceالمعجم الكبير للطبراني / باب الواو / 18276