Jabir bin Abdullah reported,

The areas around the mosque had become vacant, so Banu Salama wanted to move closer to the mosque. When this reached the Messenger of Allah ﷺ, he said to them, "I have been told that you want to move closer to the mosque."They replied, "Yes, Messenger of Allah, that is what we intended."He said, "Banu Salama, stay in your homes, your footsteps will be recorded. Stay in your homes, your footsteps will be recorded."

Muslim 1519

Sahih

حدثنا محمد بن المثنى حدثنا عبد الصمد بن عبد الوارث قال سمعت أبي يحدث قال حدثني الجريري عن أبي نضرة

عن جابر بن عبد الله قال

خلت البقاع حول المسجد فأراد بنو سلمة أن ينتقلوا إلى قرب المسجد فبلغ ذلك رسول الله ﷺ فقال لهم إنه بلغني أنكم تريدون أن تنتقلوا قرب المسجد قالوا نعم يا رسول الله قد أردنا ذلك فقال يا بني سلمة دياركم تكتب آثاركم دياركم تكتب آثاركم

مسلم 1519صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Mosques and places of prayer
Chapter
Virtue of taking many steps to the mosques
Numbering
Darussalam 1519
Muslim 1519