I used to smoke, and had repeated attempts to give up, which kept failing. In the end the way I did it was to change they way I saw these "failures". This was because every time I'd given up and then had a cig a few days later, I'd just think I'd failed, and start smoking again.
So, instead, after giving up, when I then gave in and had a cig, instead of thinking "failed again, best carry on smoking", I'd think of myself as a non-smoker who had just happened to have a cigarette - there's plenty of "social smokers" so it does happen anyway. This way, I'd still have the odd one after giving up, but the gaps would get longer and longer in between. Part of the trick was to avoid buying a pack to myself, I'd either get some off a mate, or else share a pack with someone, so they'd be gone quick and I could go back to "giving up".
It may not work for everyone, but it did for me. Even now, if I fancy a cigarette I'll have one, and it doesn't start me smoking again. I probably have 2 or 3 a year now, just for old times sake!