Sahih al-Bukhari 5066
Narration text is preserved in its supplied Arabic and English. Translated interfaces and reading guides do not add narration translations in other languages.
يَا مَعْشَرَ الشَّبَابِ مَنِ اسْتَطَاعَ الْبَاءَةَ فَلْيَتَزَوَّجْ، فَإِنَّهُ أَغَضُّ لِلْبَصَرِ، وَأَحْصَنُ لِلْفَرْجِ، وَمَنْ لَمْ يَسْتَطِعْ فَعَلَيْهِ بِالصَّوْمِ، فَإِنَّهُ لَهُ وِجَاءٌ "
Narrated `Abdullah:
We were with the Prophet (ﷺ) while we were young and had no wealth whatever. So Allah's Messenger (ﷺ) said, "O young people! Whoever among you can marry, should marry, because it helps him lower his gaze and guard his modesty (i.e. his private parts from committing illegal sexual intercourse etc.), and whoever is not able to marry, should fast, as fasting diminishes his sexual power."
Full reference and source
Sahih al-Bukhari 5066 In-book : Book 67, Hadith 4 USC-MSA web (English) : Vol. 7, Book 62, Hadith 4 (deprecated)
View source on Sunnah.com (opens in a new tab)