Ka'b b. Malik said that the Prophet always came back from a journey by day in the forenoon, and when he arrived he went first to the mosque, and having prayed two rak'as in it he sat down in it.
Abu Huraira reported God's Messenger as saying, “If anyone hears a man crying out in the mosque about something he has lost, he should say, ‘May God not restore it to you,’ for the mosques were not built for this.”
Narrated Abu Usaid reported God's Messenger as saying:
When any of you enters the mosque he should say, “O God, open to me the gates of Thy mercy, “and when he goes out he should say “O God, I ask Thee out of Thine abundance.”