Honestly? You just stop doing it. I know this sounds trite, but that moment you walk into the gas station, and tell the clerk you want a pack of ciggs? you know you're doing wrong, you know you're justifying it to yourself. You know you're backsliding.
It only takes 2 weeks for the withdrawals to go away, after that, it's just the habit biting at your neck, telling you "oh just one, just one while we're drinking", and you just reply with a "no,"
For me, what really worked was thinking about how much money the tobacco industry makes off of the sale of items they know are killing you, they don't give a fuck, they want you addicted, want you poor, want you smoking. Every time you smoke you a cigarette, you might as well be blowing a tobacco executive, sucking and slurping on their fucking cock until they blow a load in your mouth. That's how bad it is. That's how much of a bitch to them you're being, you might as well be drinking their cum, because that's how they see you: as a bitch.
Now get the fucking tobacco industry's dick out of your fucking mouth.