Wa `alaykum as-Salamu wa Rahmatullahi wa Barakatuh.
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
Dear questioner, thank you for your question and the confidence you place in our service and we pray to Allah to enable us render this service purely for His Sake.
Lowering one’s gaze is one of the most important things that a Muslim should do to protect himself from the punishment of Allah.
Every sincere Muslim should spare no pains in this regard and should take practical steps to guard his gaze and overcome his weakness.
Focusing on the question at hand, the prominent Muslim scholar Sheikh Muhammad Saleh Al-Munajjid, a prominent Saudi Muslim scholar and lecturer, states:
Shari`ah came to forbid the ways that lead to immorality, one of which is looking at non-mahram (marriageable) women. Almighty Allah says, “Tell the believing men to lower their gaze (from looking at forbidden things), and protect their private parts (from illegal sexual acts)” (An-Nur 24:30)
In his commentary on this verse, Imam Ibn Kathir wrote, “This is a command from Allah to His believing slaves to lower their gaze and refrain from looking at that which is forbidden to them. So they should not look at anything except that which they are permitted to look at, and they should lower their gaze and refrain from looking at forbidden things. If it so happens that a person’s gaze accidentally falls upon something forbidden, he should quickly avert his gaze.”
It was narrated that Jarir ibn `Abdullah said: “I asked the Messenger of Allah (peace and blessings be upon him) about an accidental glance, and he commanded me to avert my gaze.” (Muslim)
Imam An-Nawawi said, “What is meant by an “accidental glance” is when a person’s glance unintentionally falls upon a non-mahram woman. There is no sin on him for the first glance, but he must avert his gaze immediately. If he averts his gaze immediately there is no sin on him, but if he continues looking, then he will be a sinner, because of this hadith, for the Prophet (peace and blessings be upon him) commanded him to avert his gaze, and Allah says, “Tell the believing men to lower their gaze (from looking at forbidden things), and protect their private parts (from illegal sexual acts).” (An-Nur 24:30)
Men must lower their gaze and refrain from looking at forbidden things in all circumstances, unless there is a valid reason, such as giving testimony, medical treatment, proposing marriage, buying a slave woman, engaging in financial transactions such as buying and selling, etc. In all these cases it is permissible to look as much as is required, and no more.
There are means which help a person to lower his gaze, and we ask Allah to help you to do them:
1- Bearing in mind the fact that Allah is watching you, that He sees you and is with you (by His knowledge) wherever you go. It may be a secretive glance of which your closest neighbor is unaware, but Allah knows of it, “Allah knows the fraud of the eyes, and all that the hearts conceal.” (Ghafir 40:19)
2- Seeking the help of Allah, beseeching Him and calling upon Him. Almighty Allah says, “And your Lord said: Invoke Me [i.e. believe in My Oneness (Islamic Monotheism) and ask Me for anything] I will respond to your (invocation).” (Ghafir 40:60)
3- You should know that every blessing you enjoy comes from Allah, and requires that you should give thanks for it. Part of being grateful for the blessing of sight means that you should protect it from looking at that which Allah has forbidden. Is there any reward for a good deed, other than good? “And whatever of blessings and good things you have, it is from Allah.” (An-Nahl 16:53)
4- Striving with yourself and training yourself to lower your gaze and be patient in doing so, and never giving up. Allah says, “As for those who strive hard in Us (Our Cause), We will surely guide them to Our paths.” (Al-`Ankabut 29:69)
The Prophet (peace and blessings be upon him) said, “Whoever seeks to be chaste, Allah will make him chaste, and whoever seeks to be independent of means, Allah will make him independent of means, and whoever strives to be patient, Allah will make him patient…” (Al-Bukhari)
5- Avoiding places where a person feels he will be exposed to the temptation of looking, if he can manage to avoid them, such as going to marketplaces or malls, and sitting idle in the street. The Prophet (peace and blessings be upon him) said, “Beware of sitting in the street.” They said, “We have no alternative; that is where we sit and talk.” He said, “If you insist on sitting there, then give the street its rights.” They said, “What are the rights of the street?” He said, “Lowering the gaze and refraining from causing offence…” (Al-Bukhari and Muslim)
6- You should realize that you have no choice in this matter, regardless of what the circumstances are and no matter how great is the temptation or motive to do evil, and no matter what emotions and overwhelming desires stir within your heart. You must lower your gaze and refrain from looking at forbidden things in all places and at all times. You cannot use excuses such as the environment being corrupt, or justify your mistakes by saying that you are surrounded by temptation.
7- Doing a lot of voluntary acts of worship, because doing a lot of them whilst also regularly doing the obligatory acts of worship is a means of protecting one’s physical faculties. According to a hadith qudsi (Divine), Allah said: “… and My slave continues to draw close to Me with supererogatory works so that I shall love him. And when I love him, I am his hearing with which he hears, his seeing with which he sees, his hand with which he strikes and his foot with which he walks. Were he to ask (something) of Me, I would surely give it to him, and were he to ask Me for refuge, I would surely grant him it.” (Al-Bukhari)
8- Remembering that the earth on which sin is committed will bear witness for or against us. Allah says: “That Day it will declare its information (about all that happened over it of good or evil).” (Az-Zalzalah 99:4)
9- Bearing in mind some of the texts which forbid one from letting the gaze wander freely, such as the verse in which Allah says, “Tell the believing men to lower their gaze (from looking at forbidden things).” (An-Nur 24:30)
10- Avoiding unnecessary looks, so that you only look at what is needed to look at, and you do not allow your gaze to wander right and left so that it falls upon something the effects and temptation of which cannot be got rid of quickly.
11- Marriage is one of the most effective remedies. The Prophet (peace and blessings be upon him) said, “Whoever can afford it, let him get married, for it is more effective in lowering the gaze and in guarding one’s chastity. And whoever cannot afford it, let him fast, for it will be a shield for him.” (Al-Bukhari and Muslim)
12– Remembering al-hur al-`een (maidens in Paradise), which will motivate you to be patient in avoiding that which Allah has forbidden, hoping to obtain this blessing. Allah said: “Companions of equal age.” (An-Naba’ 78:33)
And the Prophet (peace and blessings be upon him) said: “If a woman of the people of Paradise were to look out over the people of this earth, it would light up everything in between and fill it with fragrance, and the veil of her head is better than this world and everything in it.” (Al-Bukhari)
You should also bear in mind the shortcomings of the one who attracts you.
13- Checking yourself from time to time and striving to make yourself lower your gaze whilst being patient, realizing that everyone makes mistakes.
14- Thinking of the pain and regret that will result from this looking, and the negative effects of allowing one’s gaze to wander.
15 – Understanding the benefits of lowering one’s gaze, as mentioned above.
16- Bringing up this topic during meetings and gatherings, and explaining its dangers to others.
17- Advising your relatives, telling them not to wear clothes that attract attention and show their beauty, such as how they dress, wearing bright colors, how they walk, speaking too softly, etc.
18- Warding off passing thoughts and the whispers of Satan before they take hold and are acted upon. Whoever lowers his gaze after the first glance will be saved from innumerable problems, but if he continues to look he cannot be certain that seeds that will be difficult to remove, will not be planted in his heart.
19- Being afraid of an evil end, and of a feeling of great regret at the point of death.
20- Keeping the company of good people, because you are naturally affected by the characteristics of the people you mix with, and a person will follow the way of his close friend, and a friend will pull you to follow his way.
Allah Almighty knows best.
Excerpted, with slight modifications, from: www.islamqa.info