Stop the habit cycle
According to the latest psychology research our habits are made up of a cycle of trigger-behavior-reward. In order to change a habit what you have to do is to keep the reward, but link it to a different behavior.
In order to end a habit what you have to do is to identify the trigger and then do a different behavior until the original trigger-behavior link is broken.
Triggers almost always are one of these categories
Straight after doing something
(source: Duhigg, C. (2012) The power of habit. 978-1-4000-6928-6 page 283)
So if you want to find out what triggers smoking for example, every time you get the urge to smoke, write down:
Where was I at time?
What time was it ?
What state was I in emotionally?
Who was there?
What had I just done?
From examining the answers, a pattern should emerge. Becoming aware of that pattern will suggest a strategy for disrupting the habit cycle.