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

Abu Musa reported Allah's Messenger (ﷺ) as saying:

The most eminent among human beings (as a recipient of) reward (is one) who lives farthest away, and who has to walk the farthest distance, and he who waits for the prayer to observe it along with the Imam, his reward is greater than one who prays (alone) and then goes to sleep. In the narration of Abu Kuraib (the words are):" (He waits) till he prays along with the Imam in congregation."
حَدَّثَنَا عَبْدُ اللَّهِ بْنُ بَرَّادٍ الأَشْعَرِيُّ، وَأَبُو كُرَيْبٍ قَالاَ حَدَّثَنَا أَبُو أُسَامَةَ، عَنْ بُرَيْدٍ، عَنْ أَبِي بُرْدَةَ، عَنْ أَبِي مُوسَى، قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏"‏ إِنَّ أَعْظَمَ النَّاسِ أَجْرًا فِي الصَّلاَةِ أَبْعَدُهُمْ إِلَيْهَا مَمْشًى فَأَبْعَدُهُمْ وَالَّذِي يَنْتَظِرُ الصَّلاَةَ حَتَّى يُصَلِّيَهَا مَعَ الإِمَامِ أَعْظَمُ أَجْرًا مِنَ الَّذِي يُصَلِّيهَا ثُمَّ يَنَامُ ‏"‏ ‏.‏ وَفِي رِوَايَةِ أَبِي كُرَيْبٍ ‏"‏ حَتَّى يُصَلِّيَهَا مَعَ الإِمَامِ فِي جَمَاعَةٍ ‏"‏ ‏.‏
Reference : Sahih Muslim 662
In-book reference : Book 5, Hadith 346
USC-MSA web (English) reference : Book 4, Hadith 1401
  (deprecated numbering scheme)