Abu Musa reported Allah's Messenger (ﷺ) as saying
The most eminent among human beings (as a recipient of) reward (is one) who lives farthest away, and who has to walk the farthest distance, and he who waits for the prayer to observe it along with the Imam, his reward is greater than one who prays (alone) and then goes to sleep. In the narration of Abu Kuraib (the words are):" (He waits) till he prays along with the Imam in congregation."
Ubayy b. Ka'b reported
There was a man, and I do not know of any other man, whose house was farther than his from the mosque and he never missed the prayer (in congregation). It was said to him or I said to him: It you were to buy a donkey you could ride upon it In the dark nights and in the burning sand. He said: I do not like my house to be situated by the side of the mosque, for I (eagerly) desire that my steps towards the mosque and back from it, should be recorded when I return to my family. Upon this the Messenger of Allah (ﷺ) said: Allah has gathered all (rewards) for you.
This hadith has been transmitted by Taimi with the same chain of narrators. Ubayy b. Ka'b reported : There was a person among the Ansar whose house was situated at the farthest end of Medina , but he never in missed any prayer along with the Messenger of Allah (ﷺ). We felt pity for him and said to him : O , so and so , had you bought a donkey it would have saved you from the burning sand and would have saved you from the reptiles of the earth. He said : Listen I by Allah , I do not like my house to be situated by the side of Muhammad (ﷺ). I took (these words of his) ill and came to the Messenger of Allah (ﷺ) and informed him about (these words). He (the Holy Prophet) called him and he said exactly like that (which he had mentioned to Ubbay b. Ka'b) , but made a mention of this (also) that he wanted a reward for his steps. Upon this the Messenger of Allah (ﷺ) said : In fact for you is the reward which you expect. A hadith like this has been narrated by 'Asim with the same chain of transmitters.
Jabir b. 'Abdullah narrated
Our houses were situated far away from the mosque; we, therefore, decided to sell our houses so that we may be able to come near the mosque. The Messenger of Allah (ﷺ) forbade us (to do so) and said: There is for every step (towards the mosque) a degree (of reward) for you.
Jabir b. Abdullah reported
There were some plots vacant around the mosque. Banu Salama decided to shift (to this land) and come near the mosque. This (news) reached the Messenger of Allah (ﷺ) and he said to them (Banu Salama): I have received (information) that you intend to shift near the mosque. They said: Yes, Messenger of Allah, we have taken this decision. Upon this he (the Holy Prophet) said: O Banu Salama, live in your houses, for your steps are recorded; live in your houses, for your steps are recorded.
Jabir b. Abdullah reported that Banu Salama decided to shift near the mosque (as there were) some plots vacant. This (news) reached the Messenger of Allah (ﷺ), whereupon he said
O people of the Salama tribe, you better stay in your houses (where you are living), for your footsteps are recorded They said. We could not be more delighted even by shifting (near the mosque) as we were delighted (on hearing these words from the Messenger of Allah (ﷺ).