كتاب الصلاة
2  
The Book of Prayer
Bulugh al-Maram 228
Narrated Abu Juhaim bin al-Harith (RA):
Allah's Messenger (ﷺ) said: "If the person who passes in front of another person in prayer knew the magnitude of his sin, it would have been better for him to wait for forty than pass in front of him." [Agreed upon. This wording is from al-Bukhari].
عَنْ أَبِي جُهَيْمِ بْنِ اَلْحَارِثِ ‏- رضى الله عنه ‏- قَالَ : قَالَ رَسُولُ اَللَّهِ ‏- صلى الله عليه وسلم ‏-{ لَوْ يَعْلَمُ اَلْمَارُّ بَيْنَ يَدَيِ اَلْمُصَلِّي مَاذَا عَلَيْهِ مِنْ اَلْإِثْمِ لَكَانَ أَنْ يَقِفَ أَرْبَعِينَ خَيْرًا لَهُ مِنْ أَنْ يَمُرَّ بَيْنَ يَدَيْهِ } مُتَّفَقٌ عَلَيْهِ , وَاللَّفْظُ لِلْبُخَارِيِّ .‏ 1
Reference : Bulugh al-Maram 228
In-book reference : Book 2, Hadith 228
English translation : Book 2, Hadith 226
Bulugh al-Maram 228
It is mentioned in al-Bazzar through another chain with the addition:
"forty years."
وَوَقَعَ فِي "اَلْبَزَّارِ" مِنْ وَجْهٍ آخَرَ : { أَرْبَعِينَ خَرِيفًا } 1
Reference : Bulugh al-Maram 228
In-book reference : Book 2, Hadith 228
Hadith Text
Reference