Answered by Sayyidi Habib Umar bin Hafiz (may Allah protect him and benefit us by him)
Do not deem yourself incapable of repenting even if you keep committing the sin a hundred times a day. Do not forget that you have a Lord Who is completely aware of you. As long as you repent to Him sincerely He will see this, even if you keep repeating the same sin. He will rid you of this disobedience in due course, according to your sincerity.
You must never cut your connection to Him. Never believe what the Devil, your enemy, tells you. Do not say to yourself that there is no hope for me and that I will never be able to stop doing this. No! This is a ploy which your lower self and the Devil use to cut you off from your Lord.
Go back to Him in a state of remorse, and say: “O Lord, help me.” If you fall into it again, return to Allah with remorse once again, repent and resolve never to do it again.
When Allah witnesses your sincerity and persistence, He will have mercy on you. He will strengthen you and you save you from this act of disobedience, whenever He wishes.
Allah says: Those who, when they do something shameful or wrong themselves, remember Allah and seek forgiveness for their sins – and who can forgive sins except Allah? – and who never knowingly persist in doing wrong (Al-Imran, 3:135).
Distance yourself from the people, the places and the devices which cause you to sin.
Instead keep the company of the pious and make abundant remembrance of Allah. This will have an effect on you.
The following adhkar are particularly beneficial. Recite the following at least ten times a day:
Huw’Allahu’lladhi la ilaha illa hu, ‘Alimu’l ghaybi wash-shahadah, Hu arrahmanu’ rrahim
“He is Allah, there is no deity save Him, Knower of the unseen and the seen, He is the All-Compassionate, the All-Merciful.” (Al-Hashr, 59:22)
Recite this 100 times a day:
Rabbi-shrah li sadri wa yassir li amri
“My Lord bring tranquillity to my heart and give me ease in my affair.” (Ta Ha 20:25-26)
All enabling grace is from Allah.