Sunan Abi Dawud Book 2, Hadith 166
The Prophet (ﷺ) said: The further one is from the mosque , the greater will be one's reward.
‘Uthman b. ‘Affan reported the Messenger of Allah (may peace be him) as saying; if anyone says the night prayer in congregation, he is like one who keeps vigil (in prayer) till midnight; and he who says both the night and dawn prayer in congregation is like one who keeps vigil (in prayer) the whole night.
There was a certain person, out of all people of Medina, who used to pray in the mosque. I do not know that any one of them lived at a farther distance than that man. Still he never missed the prayer in congregation in the mosque. I said: it would be better if you buy a donkey and ride it in heat and darkness. He said: I do not like that my house be by the side of the mosque. The discourse reached the Messenger of Allah (ﷺ). He said him about it. He said: I did it so that my walking to the mosque and return to my home when I return be recorded. He said: Allah has granted all this to you; Allah has granted all that you reckoned.