It honestly depends. Is the person spiritually minded? Do they believe in God and having a purpose, hope, etc? What substances are they?
Honestly the way I quit was a bit...unorthodox. I'm not saying not to pray and ask for help, but the thing that did it for me was to, uh, STOP asking for help and realize that I had control over it. Does that mean I'm free of mistakes? Absolutely not. However, a lot of people get the idea that they're a slave to something - whether it's sin, a substance, whatever. This causes a tremendous amount of damage.
I quit crystal meth without going to rehab. They say that's next to impossible. I'm not saying that rehab is useless, but I am encouraging the power of self-control.
Keep in mind that it depends on the substance, too. Some drugs are PHYSICALLY addictive - opiates, for instance (heroin, morphine, oxycodone, fentanyl, etc) - and those drugs are hard to deal with outside of detox. Most drugs, if possessing addictive properties, are hard to kick just because the brain wants it. However, if he/she has already been in rehab multiple times, detox and counseling may not be doing it for them.
My best suggestion is something you may not be able to do that much about - have the person realize that they ultimately have control of themselves, their outlook, their environment, and the results they get. It really helps.
Who knows, perhaps the more self empowering state of mind was an answer to the prayer.