Hadithcore
Sahih Muslim, 664
sahih

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.

وَحَدَّثَنَا حَجَّاجُ بْنُ الشَّاعِرِ، حَدَّثَنَا رَوْحُ بْنُ عُبَادَةَ، حَدَّثَنَا زَكَرِيَّاءُ بْنُ إِسْحَاقَ، حَدَّثَنَا أَبُو الزُّبَيْرِ، قَالَ سَمِعْتُ جَابِرَ بْنَ عَبْدِ اللَّهِ، قَالَ كَانَتْ دِيَارُنَا نَائِيَةً عَنِ الْمَسْجِدِ، فَأَرَدْنَا أَنْ نَبِيعَ، بُيُوتَنَا فَنَقْتَرِبَ مِنَ الْمَسْجِدِ فَنَهَانَا رَسُولُ اللَّهِ صلى الله عليه وسلم فَقَالَ ‏

‏ إِنَّ لَكُمْ بِكُلِّ خُطْوَةٍ دَرَجَةً ‏

‏ ‏.‏

References2 variants
In-Book Reference
Book 5, Hadith 351
USC-MSA web (English) reference
Book 4, Hadith 1406 (deprecated numbering scheme)
Sharh · explanationclick to expand
Taking many steps to the mosque is one of the greatest means of reward. The more distant the mosque and the more steps are taken to it, the greater the reward. In this Hadīth, Jābir ibn ‘Abdullāh (may Allah be pleased with him) informs that their houses were situated far from the mosque, as they lived on the outskirts of Madīnah. These are the dwellings of Banu Salamah, a group of the Ansār. They wanted to sell these dwellings, given their remoteness, and buy dwellings close to the mosque, seeking to be the neighbors of the Messenger of Allah (may Allah's peace and blessings be upon him). But, the Prophet (may Allah's peace and blessings be upon him) forbade them from that and explained to them the reward of which they didn't know. He said to them: "With every step there is a degree for you." When your house is more distant from the mosque, every step you take brings a high rank in Paradise, and the more steps you take, the greater the reward. Thus, he (may Allah's peace and blessings be upon him) urged them to stay in their houses and not leave them. As related in a Hadīth reported by Anas (may Allah be pleased with him) and narrated by Al-Bukhāri: "The Messenger of Allah (may Allah's peace and blessings be upon him) disliked that Madīnah be vacated", i.e., that parts of Madīnah become empty of people and houses. So, by staying in their places, the Prophet (may Allah's peace and blessings be upon him) wanted the areas of Madīnah to be inhabited, so that the Muslims would seem large in number in the eyes of the hypocrites and polytheists, frightening them and showing toughness towards them. The Messenger of Allah (may Allah's peace and blessings be upon him) did not explicitly say it to them; he only mentioned to them the clear benefit, which would encourage them to agree and prompt them to stay at their houses. The Hadīth shows the Prophet's concern about his Ummah and his keenness to direct them to what is good and to make the best use of it..