عن أبي هريرة رضي الله عنه أن النبي صلى الله عليه وسلم قال‏:‏ ‏"‏ من غدا إلى المسجد أو راح، أعد الله له في الجنة نزلا كلما غدا أو راح‏"‏‏.‏ ‏(‏‏(‏متفق عليه‏)‏‏)‏‏.‏
Copy
Ubayy bin Ka'b (May Allah be pleased with him) reported

There was a man of the Ansar whose house was the farthest from the mosque. As far as I know, he never missed Salat (in congregation). It was said to him: "If you buy a donkey, you may ride upon it in the dark nights and in the hot days." He said: "I do not like that my house should be situated close to the mosque. I desire that my walking towards the mosque and returning home be recorded to my credit." Upon this the Messenger of Allah (ﷺ) said, "Allah has gathered all (rewards) for you."[Muslim].