Fiqh-us-Sunnah Volume 002, Supererogatory Prayer, Fiqh 2.081.

Section : The following acts are permissible during the prayer.

Crying, moaning, or groaning, regardless of whether it is due to a fear of Allah or to any other reason (e.g., a moan due to some pain or injury that one cannot contain), is permissible. This is based on the Qur'anic verse: "When the revelations of the Merciful were recited unto them, they fell prostrating and adoring." This verse is general and includes one who is praying.

'Abdullah ibn ash-Schikhir relates: "I saw the Messenger of Allah praying and his chest was 'buzzing', like the buzzing of a cooking pot, due to crying." This is related by Ahmad, Abu Dawud, an-Nasa'i, and at-Tirmizhi. The latter classifies it as sahih.

'Ali reports: "There was no horseman among us at the battle of Badr save al-Miqdad ibn al-Aswad. I saw that not one of us was standing save the Messenger of Allah who was praying under a tree and crying until the dawn." This is related by Ibn Hibban.

'Aishah relates the incident that occurred during the fatal illness of the Prophet sallallahu alehi wasallam. The Messenger of Allah said: "Order Abu Bakr to lead the people in prayer." 'Aishah responded: "O Messenger of Allah, Abu Bakr is a very soft-hearted man and he cannot control his tears, and if he recites the Qur'an, he cries." 'Aishah later admitted: "I said that only because I hated that the people should blame Abu Bakr for being the first to take the place of the Messenger of Allah." The Messenger of Allah said: "Order Abu Bakr to lead the people in salah. You women are like the companions of Yusuf." This is related by Ahmad, Abu Dawud, Ibn Hibban, and at-Tirmizhi who calls it sahih. The fact that the Prophet insisted that Abu Bakr lead the salah after he was informed that he would be overcome by weeping proves that it is permissible to cry while praying.

'Umar prayed fajr and recited Surah Yusuf, and when he reached the verse "I expose my distress and anguish only unto Allah," he raised his voice in crying. This is related by al-Bukhari, Sa'id ibn Mansur, and ibn al-Munzhir. In 'Umar's raising his voice in crying is a refutation of those who say that crying invalidates the salah if it causes a sound from the mouth, regardless of whether it is due to the fear of Allah or not. They argue that sound from the mouth due to crying is like speaking, but this is not acceptable as  crying and speaking are two different things.

Related Hadith(s)