In The Name of Allaah, The Most Merciful, The Bestower of Mercy

It is appropriate that when entering the Masjid, one asks Allaah for mercy, for he [i.e. person] came whilst hoping for Allaah’s Mercy and Reward. And it is appropraite that when leaving the Masjid, he asks Allaah for His Bounty, because he leaves the Masjid whilst hoping for Allaah’s bounty and provision, and this is similar to what is stated in Surah Al-Jumu’ah, [because] Allaah forbids [us from engaging in] buying and selling when the A’dhaan of Jumu’ah is heard, but permits [us] to disperse in the land and seek His bounty after the Jumu’ah prayer. Allaah [The Mighty and Majestic] said:
O you who believe [Muslims]! When the call is proclaimed for the Salat [prayer] on the day of Friday [Jumu’ahprayer], come to the remembrance of Allah [Jumu’ah religious talk [Khutbah] and Salat [prayer] and leave off business [and every other thing], that is better for you if you did but know!
Then when the [Jumu’ah] Salat [prayer] is finished, you may disperse through the land, and seek the Bounty of Allah [by working, etc.], and remember Allah much, that you may be successful.
[Surah Al-Jumu’ah’ Aayaat 9 – 10]