If a person sneezes whilst praying, should he say “Al-hamdu Lillaah (praise be to Allaah)”? And if he hears a donkey braying, should he say “A’oodhu Billaahi min al-Shaytaan il-rajeem (I seek refuge with Allaah from the accursed Shaytaan)?”.
With regard to sneezing, it is narrated in the Sunnah that a worshipper should say al-hamdu Lillaah if he sneezes.
With regard to seeking refuge with Allaah from the accursed Shaytaan when hearing a donkey braying (whilst one is praying), there is no report in the Sunnah to that effect.
Shaykh Ibn ‘Uthaymeen said:
If a person sneezes whilst praying, he should say Al-hamdu Lillah, as was narrated in the saheeh report of the story of Mu’aawiyah ibn al-Hakam (may Allaah be pleased with him) when he started to pray with the Prophet (peace and blessings of Allaah be upon him), then a man among the people sneezed and said, “Al-hamdu Lillaah.” Mu’aawiyah said to him, “Yarhamuk Allaah (may Allaah have mercy on you).” The people glared at Mu’aawiyah, denouncing him for speaking. He said: “May my mother be bereft of me!” then they started to beat their hands on their thighs, indicating to him to be quiet, so he was quiet. When the prayer was over, the Prophet (peace and blessings of Allaah be upon him) called him. Mu’aawiyah said: May my father and mother be sacrificed for him. By Allaah, he did not scold me or beat me or rebuke me. He said: “This prayer should not include anything of people’s talk; rather it is tasbeeh (saying ‘Subhaan Allaah’ – glory be to Allaah), takbeer (saying ‘Allaahu akbar’ – Allaah is Most Great) and reciting Qur’aan.” Narrated by Muslim, 537; Abu Dawood, 930.
The Prophet (peace and blessings of Allaah be upon him) did not tell off the one who sneezed and said Al-hamdu Lillaah whilst praying, which indicates that if a person sneezes during the prayer he should say al-hamdu Lillaah, because there is a reason for doing so. But that does not apply to every dhikr for which the reason for saying it occurs whilst one is praying.
Fataawa Ibn ‘Uthaymeen, 13/342.
And he was asked:
Is it permissible for one who is praying to say al-hamdu Lillaah if he sneezes, and to seek refuge with Allaah if he hears a donkey braying? Is there a difference between obligatory prayers and naafil prayers in that regard?
With regard to saying al-hamdu Lillaah if he sneezes and seeking refuge with Allaah if he hears a donkey braying, that is permissible according to the view favoured by Shaykh al-Islam Ibn Taymiyah (may Allaah have mercy on him), but it is makrooh according to the well known view of the madhhab of Imam Ahmad. The more correct view is that favoured by Shaykh al-Islam with regard to saying al-hamdu Lillaah if one sneezes. With regard to seeking refuge with Allaah when hearing a donkey braying, it is better not to do that. The difference between them is that saying al-hamdu Lillaah when sneezing is mentioned in the Sunnah, and because it is prescribed by a specific command, unlike when a donkey brays, which is does not concern him, and the worshipper should not let himself be distracted by sounds outside the prayer.
With regard to the above, it makes no difference whether the prayer is a prescribed (obligatory) prayer or a naafil (supererogatory) prayer.”
Fataawa Ibn ‘Uthaymeen, 13/342.
And Allaah knows best.