I used to compulsively take illegal psychoactive substances, had a bad addiction. I couldn't sleep without having them in my possession and wouldn't sleep if I did have them. I remember a counselor telling me to use the 5 minute rule as an aid to overcoming temptation. "Just wait 5 minutes, tell yourself: not now but later" he would say. Eventually that 5 minutes turned into 4 years and 11 months. Took a while but I got the hang of it.
"Remove prostitutes from human affairs, and you will unsettle everything because of lusts..."
St Augustine