He has the habit of looking at nude pictures
Praise be to Allaah.
First of all, you have to repent from this great sin, because each person will have to answer for his actions on the Day of Resurrection. Allaah says (interpretation of the meaning):
“Verily, the hearing, and the sight, and the heart of each of those ones will be questioned (by Allaah)” [al-Israa’ 17:36]
And the Prophet (peace and blessings of Allaah be upon him) said:
“The eye commits zinaa (fornication, adultery), and its zinaa is looking.”
(narrated by al-Bukhaari, al-Isti’dhaan, 5774). So you have to repent sincerely from this action, and that includes several things:
Giving up this sin, out of fear of the punishment of Allaah.
Deeply regretting what you have done of this haraam thing.
Sincerely resolving not to return to this sin ever again.
You should know that there are many ways of purifying the soul from these haraam things, such as:
Adhering firmly to repentance, saying a lot of du’aa’, frequently seeking Allaah’s forgiveness and repenting, persisting in dhikr, doing lots of acts of worship and good deeds, and praying a lot. Allaah says (interpretation of the meaning):
“Verily, As Salaah (the prayer) prevents from Al‑Fahshaa’ (i.e. great sins of every kind, unlawful sexual intercourse) and Al Munkar (i.e. disbelief, polytheism, and every kind of evil wicked deed)” [al-‘Ankaboot 29:45]
“And perform As Salaah (Iqaamat as Salaah), at the two ends of the day and in some hours of the night [i.e. the five compulsory Salaah (prayers)]. Verily, the good deeds remove the evil deeds (i.e. small sins)” [Hood 11:114]
You have to look for a good environment to live in, and for righteous friends who will help you to do good, so that you may keep away from these things. All of these actions will purify and cleanse your soul, and help you to please Allaah. Allaah says (interpretation of the meaning):
“Indeed, he succeeds who purifies his own self [his soul]…”[al-Shams 91:9]
You should know that when a person is sincere in his repentance and prays to Allaah, and asks Him to keep him safe from the evil of his own self and from the Shaytaan, Allaah will protect him from the waswaas (insinuating whispers) and plots of the Shaytaan. Allaah says (interpretation of the meaning):
“And whosoever fears Allaah and keeps his duty to Him, He will make a way for him to get out (from every difficulty) [al-Talaaq 65:2]
May Allaah help us and you to repent and to adhere steadfastly to Islam.