OT but on trying to quit smoking.
No solution for the sober part other than those who've succeeded, that I've known, have stayed away from friends who drink, and places that sell.
I used to smoke 3-4 packs per week. I liked a certain brand, they were $7 a pack at that time. I decided three years ago to tally up how much I was spending, on average, per month. It was enough to make the majority of my m/c payment. I laid them down. For me it was the money factor. Try tallying it up and see if it equals a new toy you'd like to have or something you've been wanting for the house, that may help do the trick. Every time you want a smoke, think of that thing you'd like to have and could put that money toward.