Sunan an-Nasa'i, Book 22, Hadith 151 (In-Book)

It was narrated from 'Alqamah that: Ibn Masud met 'Uthman at 'Arafat and spoke to him in private. Uthman said to Ibn Masud: "Are you interested in a girl so that I marry her to you?" 'Abdullah called 'Alqamah and he told him that the Prophet said: 'Whoever among you can afford to get married, let him do so. Whoever cannot afford it, let him fast, for fasting will be a restraint (Wija) for him."'

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

sunnah.com