Sunan an-Nasa'i, Volume 4, Book 26, Hadith 3211 (DarusSalam)

Narrated 'Abdullah: It was narrated that 'Abdullah said: "The Messenger of Allah said to us: 'O young men, whoever among you can afford it, let him get married, for it is more effective in lowering the gaze and guarding chastity, and whoever cannot then he should fast, for it will be a restraint (wija') for him.'"

أَخْبَرَنَا مُحَمَّدُ بْنُ مَنْصُورٍ، قَالَ حَدَّثَنَا سُفْيَانُ، عَنِ الأَعْمَشِ، عَنْ عُمَارَةَ بْنِ عُمَيْرٍ، عَنْ عَبْدِ الرَّحْمَنِ بْنِ يَزِيدَ، عَنْ عَبْدِ اللَّهِ، قَالَ قَالَ لَنَا رَسُولُ اللَّهِ صلى الله عليه وسلم ‏ "‏ يَا مَعْشَرَ الشَّبَابِ مَنِ اسْتَطَاعَ مِنْكُمُ الْبَاءَةَ فَلْيَنْكِحْ فَإِنَّهُ أَغَضُّ لِلْبَصَرِ وَأَحْصَنُ لِلْفَرْجِ وَمَنْ لاَ فَلْيَصُمْ فَإِنَّ الصَّوْمَ لَهُ وِجَاءٌ ‏" ‏ ‏.‏

sunnah.com