Sahih Muslim 663 a
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.
حَدَّثَنَا يَحْيَى بْنُ يَحْيَى، أَخْبَرَنَا عَبْثَرٌ، عَنْ سُلَيْمَانَ التَّيْمِيِّ، عَنْ أَبِي عُثْمَانَ النَّهْدِيِّ، عَنْ أُبَىِّ بْنِ كَعْبٍ، قَالَ كَانَ رَجُلٌ لاَ أَعْلَمُ رَجُلاً أَبْعَدَ مِنَ الْمَسْجِدِ مِنْهُ وَكَانَ لاَ تُخْطِئُهُ صَلاَةٌ - قَالَ - فَقِيلَ لَهُ أَوْ قُلْتُ لَهُ لَوِ اشْتَرَيْتَ حِمَارًا تَرْكَبُهُ فِي الظَّلْمَاءِ وَفِي الرَّمْضَاءِ ‏.‏ قَالَ مَا يَسُرُّنِي أَنَّ مَنْزِلِي إِلَى جَنْبِ الْمَسْجِدِ إِنِّي أُرِيدُ أَنْ يُكْتَبَ لِي مَمْشَاىَ إِلَى الْمَسْجِدِ وَرُجُوعِي إِذَا رَجَعْتُ إِلَى أَهْلِي ‏.‏ فَقَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏
"‏ قَدْ جَمَعَ اللَّهُ لَكَ ذَلِكَ كُلَّهُ ‏"‏ ‏.‏