Resolute force of will - make it a challenge within yourself to see how long you can go without doing that thing, & feel satisfaction at your triumph
Don't associate with people / places that pull you into repetition of the habit
Do associate with people who don't have the habit