كتاب النكاح
16  
The Book of Marriage
(1)
Chapter: Marriage is recommended for the one who desires it and can afford it, and the one who cannot afford it should distract himself by fasting
(1)
باب اسْتِحْبَابِ النِّكَاحِ لِمَنْ تَاقَتْ نَفْسُهُ إِلَيْهِ وَوَجَدَ مُؤْنَةً وَاشْتِغَالِ مَنْ عَجَزَ عَنِ الْمُؤَنِ بِالصَّوْمِ
Sahih Muslim 1400 c

Abdullah (b. Mas'ud) (Allah be pleased with him) reported that Allah's Messenger (ﷺ) said to us:

0 young men, those among you who can support a wife should marry, for it restrains eyes (from casting evil glances) and preserves one from immorality; but he who cannot afford It should observe fast for it is a means of controlling the sexual desire.
حَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ، وَأَبُو كُرَيْبٍ قَالاَ حَدَّثَنَا أَبُو مُعَاوِيَةَ، عَنِ الأَعْمَشِ، عَنْ عُمَارَةَ بْنِ عُمَيْرٍ، عَنْ عَبْدِ الرَّحْمَنِ بْنِ يَزِيدَ، عَنْ عَبْدِ اللَّهِ، قَالَ قَالَ لَنَا رَسُولُ اللَّهِ صلى الله عليه وسلم ‏ "‏ يَا مَعْشَرَ الشَّبَابِ مَنِ اسْتَطَاعَ مِنْكُمُ الْبَاءَةَ فَلْيَتَزَوَّجْ فَإِنَّهُ أَغَضُّ لِلْبَصَرِ وَأَحْصَنُ لِلْفَرْجِ وَمَنْ لَمْ يَسْتَطِعْ فَعَلَيْهِ بِالصَّوْمِ فَإِنَّهُ لَهُ وِجَاءٌ ‏"‏ ‏.‏
Reference : Sahih Muslim 1400c
In-book reference : Book 16, Hadith 3
USC-MSA web (English) reference : Book 8, Hadith 3233
  (deprecated numbering scheme)