It is narrated from Sayyiduna Mu'awiyah bin al-Hakam al-Sulami (may Allah be pleased with him): When I came into the presence of the Messenger of Allah (peace and blessings be upon him), the Messenger of Allah (peace and blessings be upon him) taught me many rulings of Islam, namely: "When you sneeze, say 'Al-hamdu lillah' (All praise is for Allah); and when someone else sneezes and says 'Al-hamdu lillah', you say 'Yarhamuk Allah' (May Allah have mercy on you)." Once I was standing in prayer with the Messenger of Allah (peace and blessings be upon him) when suddenly a man sneezed and said 'Al-hamdu lillah' (All praise belongs to Allah alone), and I said in a loud voice 'Yarhamuk Allah' (May Allah have mercy on you). The people began to stare at me until I had to say: What is the matter with you, that you are looking at me with such looks? So they said 'Subhan Allah' (Allah is free of all imperfection). When the Prophet (peace and blessings be upon him) completed the prayer, he asked: "Who was the man who spoke?" He (peace and blessings be upon him) was told: This Bedouin. So he (peace and blessings be upon him) called me and said: "The prayer is only for reciting the Qur'an and the remembrance of Allah, so when you are in prayer, engage only in recitation and remembrance." I have not seen any teacher more kind and gentle than the Messenger of Allah (peace and blessings be upon him).
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 3350