Ubayy bin Kaab reported,

There was a man, and I do not know of anyone whose house was farther from the mosque than his, yet he never missed a prayer.It was said to him, or I said to him, "Why don't you buy a donkey to ride in the dark and on the scorching ground?"He replied, "It would not please me for my house to be next to the mosque. I want my walk to the mosque and my return home to be recorded for me."The Messenger of Allah ﷺ said, "Allah has gathered all of that for you."In another narration: There was a man from the Ansar whose house was the farthest house in Madinah, yet he never missed a prayer with the Messenger of Allah ﷺ. We felt sorry for him, so I said to him, "So-and-so, if only you would buy a donkey to protect you from the scorching ground and from the crawling creatures of the earth."He replied, "By Allah, I would not wish my house to be pitched right next to Muhammad's house ﷺ."I took this hard upon myself until I came to the Prophet of Allah ﷺ and told him about it. He summoned the man and said the same thing to him. The man explained that he hoped for reward in his footsteps.The Prophet ﷺ said to him, "You shall have what you have intended."

Azami 1743

Sahih

عن أبي بن كعب قال

كان رجل، لا أعلم رجلا أبعد من المسجد منه، وكان لا تخطئه صلاة، قال: فقيل له، أو قلت له: لو اشتريت حمارا تركبه في الظلماء وفي الرمضاء، قال: ما يسرني أن منزلي إلى جنب المسجد، إني أريد أن يكتب لي ممشاي إلى المسجد، ورجوعي إذا رجعت إلى أهلي، فقال رسول الله ﷺ: قد جمع الله لك ذلك كله. وفي رواية: كان رجل من الأنصار بيته أقصى بيت في المدينة، فكان لا تخطئه الصلاة مع رسول الله ﷺ، قال: فتوجعنا له، فقلت له: يا فلان! لو أنك اشتريت حمارا يقيك من الرمضاء، ويقيك من هوام الأرض. قال: أم والله ما أحب أن بيتي مطنب ببيت محمد ﷺ، قال: فحملت به حملا حتى أتيت نبي الله ﷺ فأخبرته، قال: فدعاه، فقال له مثل ذلك. وذكر له أنه يرجو في أثره الأجر، فقال له النبي ﷺ: إن لك ما احتسبت.

الأعظمي 1743صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Prayer
Chapter
Obligation of prayer and its virtue
Section
Virtue of walking to prayer
Numbering
Jami al-Kamil 1743 (2nd edition)
Azami 1743