The Prophet ﷺ said, "The people who get tremendous reward for the prayer are those who are farthest away (from the mosque) and then those who are next farthest and so on. Similarly one who waits to pray with the Imam has greater reward than one who prays and goes to bed. " (Using translation from Bukhārī 651)
"أعْظَمُ النَّاسِ أجْرًا في الصَّلاةِ أَبْعَدُهُمْ إليها مَمْشًى، فَأَبْعَدُهُمْ، والذي يَنْتَظِرُ الصَّلاةَ -حتى يُصَلِّيها مَعَ الإِمامِ- أعْظَمُ أجْرًا مِنَ الذي يُصَلِّيها، ثم يَنَامُ".