كتاب الْمَسَاجِدِ وَمَوَاضِعِ الصَّلاَةِ
5  
The Book of Mosques and Places of Prayer
(50)
Chapter: The virtue of taking many steps to the masjid
(50)
باب فَضْلِ كَثْرَةِ الْخُطَا إِلَى الْمَسَاجِدِ ‏
Sahih Muslim 665 a

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.
حَدَّثَنَا مُحَمَّدُ بْنُ الْمُثَنَّى، حَدَّثَنَا عَبْدُ الصَّمَدِ بْنُ عَبْدِ الْوَارِثِ، قَالَ سَمِعْتُ أَبِي يُحَدِّثُ، قَالَ حَدَّثَنِي الْجُرَيْرِيُّ، عَنْ أَبِي نَضْرَةَ، عَنْ جَابِرِ بْنِ عَبْدِ اللَّهِ، قَالَ خَلَتِ الْبِقَاعُ حَوْلَ الْمَسْجِدِ فَأَرَادَ بَنُو سَلِمَةَ أَنْ يَنْتَقِلُوا إِلَى قُرْبِ الْمَسْجِدِ فَبَلَغَ ذَلِكَ رَسُولَ اللَّهِ صلى الله عليه وسلم فَقَالَ لَهُمْ ‏"‏ إِنَّهُ بَلَغَنِي أَنَّكُمْ تُرِيدُونَ أَنْ تَنْتَقِلُوا قُرْبَ الْمَسْجِدِ ‏"‏ ‏.‏ قَالُوا نَعَمْ يَا رَسُولَ اللَّهِ قَدْ أَرَدْنَا ذَلِكَ ‏.‏ فَقَالَ ‏"‏ يَا بَنِي سَلِمَةَ دِيَارَكُمْ تُكْتَبْ آثَارُكُمْ دِيَارَكُمْ تُكْتَبْ آثَارُكُمْ ‏"‏ ‏.‏
Reference : Sahih Muslim 665a
In-book reference : Book 5, Hadith 352
USC-MSA web (English) reference : Book 4, Hadith 1407
  (deprecated numbering scheme)