For me personally, when I stopped a habit, I automatically replaced them with another habit. It's often a vicious circle. Once you stop a habit, you get tempted to replace it with another. Firstly, you have to really want to stop this bad habit. You could keep a calendar and mark every day that you didn't do this bad habit. You could also reward yourself. For example, if you didn't do this bad habit for a week, give yourself a little gift. You can also write down the reasons why you want to stop this bad habit and look at them when you feel tempted to do this bad habit again. If you're determined, then you can break that habit. It's difficult, but it's not impossible. It depends what sort of bad habit it is. Some are easier to deal with than others are. I hope you'll be able to break those bad habits. Good luck.
Depending on what the habit is there can be some fairly simple solutions to help get rid of or ease them. For instance i have heard of people having rubber bands on their wrists and snapping them every time they do this habit that they want to get rid of. That was you condition yourself to associate the habit with the pain or bad feeling and so you'll eventually stop doing it. I guess it entirely depends on what the habit is. a bit like classical conditioning i guess.
There's no perfect recipe. One way I suggest is to tone it down slowly, which require extended willpower, but might be easier.Another way, if you're more impulsive, commit yourself to not do it for 1 day (or 1 week - any amount short enough that sounds doable). At the end of the period, start another commitment for another short period. One day at a time, you might become less and less dependent. Committing to a short period might be a lot easier than doing so for an extended period of time.