Within the science of tasawwuf there is a concept called bilaa tamaa. Bilaa means without and tamaa means desire. Every person has 2 things within them; necessities and desires. It is the goal of every person striving on the path of Allah Subhanahu wa ta’ala to fulfil their necessities but to curtail their desires.
Desire has no end. If today you look at someone (i.e. cast unlawful gazes), the next day you will continue to look. The problem is the desire within you. So the thing you have to do is to make yourself bilaa tamaa. There are 2 ways to do it;
Firstly, recall the ayah of Allah (as mentioned in the Qur’an);
قُل لِّلْمُؤْمِنِينَ يَغُضُّوا مِنْ أَبْصَارِهِمْ
Tell the Mu’umineen (believers) that they should lower their gaze.
Surah Nur, Verse 30
Every time you are out of your house, this (verse of the Qur’an) should be your dhikr (remembrance) as you walk through the streets.
The second thing in making yourself bilaa tamaa will mean to realize, benefit and appreciate that there is no benefit in ‘looking’. What benefit does one get out of the 2nd look? Nothing. Except that it destroys your imaan (i.e. one loses the taste of imaan).
Desire never has an end. Your goal is to crush your desire. On the other hand, necessity ends. It has a limit e.g. within the sharia, Allah Subhanahu wa ta’ala has created for you marriage. There is a certain degree of necessity that a man and a woman have to interact with each other. If you stay within the realm of necessity, you will fulfill your necessity and you will be able to progress on the path towards Allah Subhanahu wa ta’ala.
If you cross that and you enter the realms of desires, your desires will never end. Your desires will drag you to the court of Allah Subhanahu wa ta’ala on the Day of Judgment and that will be a scary sight.
Your goal is to crush your desires and to fulfill your necessities.