كتاب النكاح
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 a

'Alqama reported:

While I was walking with 'Abdullah at Mina, 'Uthman happened to meet him. He stopped there and began to talk with him. Uthman said to him: Abu 'Abd al-Rahman, should we not marry you to a young girl who may recall to you some of the past of your bygone days; thereupon he said: If you say so, Allah's Messenger (ﷺ) said: 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 those who cannot should devote themselves to fasting for it is a means of controlling sexual desire.
حَدَّثَنَا يَحْيَى بْنُ يَحْيَى التَّمِيمِيُّ، وَأَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ وَمُحَمَّدُ بْنُ الْعَلاَءِ الْهَمْدَانِيُّ جَمِيعًا عَنْ أَبِي مُعَاوِيَةَ، - وَاللَّفْظُ لِيَحْيَى أَخْبَرَنَا أَبُو مُعَاوِيَةَ، - عَنِ الأَعْمَشِ، عَنْ إِبْرَاهِيمَ، عَنْ عَلْقَمَةَ، قَالَ كُنْتُ أَمْشِي مَعَ عَبْدِ اللَّهِ بِمِنًى فَلَقِيَهُ عُثْمَانُ فَقَامَ مَعَهُ يُحَدِّثُهُ فَقَالَ لَهُ عُثْمَانُ يَا أَبَا عَبْدِ الرَّحْمَنِ أَلاَ نُزَوِّجُكَ جَارِيَةً شَابَّةً لَعَلَّهَا تُذَكِّرُكَ بَعْضَ مَا مَضَى مِنْ زَمَانِكَ ‏.‏ قَالَ فَقَالَ عَبْدُ اللَّهِ لَئِنْ قُلْتَ ذَاكَ لَقَدْ قَالَ لَنَا رَسُولُ اللَّهِ صلى الله عليه وسلم ‏ "‏ يَا مَعْشَرَ الشَّبَابِ مَنِ اسْتَطَاعَ مِنْكُمُ الْبَاءَةَ فَلْيَتَزَوَّجْ فَإِنَّهُ أَغَضُّ لِلْبَصَرِ وَأَحْصَنُ لِلْفَرْجِ وَمَنْ لَمْ يَسْتَطِعْ فَعَلَيْهِ بِالصَّوْمِ فَإِنَّهُ لَهُ وِجَاءٌ ‏"‏ ‏.‏
Reference : Sahih Muslim 1400a
In-book reference : Book 16, Hadith 1
USC-MSA web (English) reference : Book 8, Hadith 3231
  (deprecated numbering scheme)