It was narrated that ‘Abdullah said: “We went out with the Messenger of Allah (peace be upon him) and we were young men who could not afford anything. He said: ‘O young men, you should get married, for it is more effective in lowering the gaze and protecting one’s chastity. Whoever cannot afford it should fast, for it will be a restraint Wija, for him.”‘
Sunan an-Nasa’i, Book 22, Hadith 150