كتاب الْمَسَاجِدِ وَمَوَاضِعِ الصَّلاَةِ
5  
The Book of Mosques and Places of Prayer
(51)
Chapter: Walking to prayer erases sins and raises one in status
(51)
باب الْمَشْىُ إِلَى الصَّلاَةِ تُمْحَى بِهِ الْخَطَايَا وَتُرْفَعُ بِهِ الدَّرَجَاتُ ‏
Sahih Muslim 667

In the hadith narrated of the authority of Abd Huraira the Messenger of Allah (ﷺ) is reported to have said. while in the hadith narrated by Bakr (the words are like this):

He heard the Messenger of Allah (ﷺ) as saying: just see, can anything of his filthiness remain (on the body of) any one of you if there were a river at his door in which he washed himself five times daily? They, said: Nothing of his filthiness will remain (on his body). He said: That is like the five prayers by which Allah obliterates sins.
وَحَدَّثَنَا قُتَيْبَةُ بْنُ سَعِيدٍ، حَدَّثَنَا لَيْثٌ، ح وَقَالَ قُتَيْبَةُ حَدَّثَنَا بَكْرٌ، - يَعْنِي ابْنَ مُضَرَ - كِلاَهُمَا عَنِ ابْنِ الْهَادِ، عَنْ مُحَمَّدِ بْنِ إِبْرَاهِيمَ، عَنْ أَبِي سَلَمَةَ بْنِ عَبْدِ الرَّحْمَنِ، عَنْ أَبِي هُرَيْرَةَ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ وَفِي حَدِيثِ بَكْرٍ أَنَّهُ سَمِعَ رَسُولَ اللَّهِ صلى الله عليه وسلم يَقُولُ ‏"‏ أَرَأَيْتُمْ لَوْ أَنَّ نَهْرًا بِبَابِ أَحَدِكُمْ يَغْتَسِلُ مِنْهُ كُلَّ يَوْمٍ خَمْسَ مَرَّاتٍ هَلْ يَبْقَى مِنْ دَرَنِهِ شَىْءٌ ‏"‏ ‏.‏ قَالُوا لاَ يَبْقَى مِنْ دَرَنِهِ شَىْءٌ ‏.‏ قَالَ ‏"‏ فَذَلِكَ مَثَلُ الصَّلَوَاتِ الْخَمْسِ يَمْحُو اللَّهُ بِهِنَّ الْخَطَايَا ‏"‏ ‏.‏
Reference : Sahih Muslim 667
In-book reference : Book 5, Hadith 355
USC-MSA web (English) reference : Book 4, Hadith 1410
  (deprecated numbering scheme)