Hey, i struggled with that until i really put an effort forth to conquor it. I know it will be hard, but it is worth it. Philippians 2:12, "Wherefore, my beloved, as ye have always obeyed, not as in my presence only, but now much more in my absence, work out your own salvation with fear and trembling.
What worked for me was to, on purpose, stay on task, and keep in the Word. So, I would have my head stuck in my Bible every chance I got. I soaked up as much of God's Word as I could, until my mind was renewed. It really works, but it takes diligence. Because I was not used to disciplining myself, but giving in so easily, i had to develop this new habit. It's the only thing that will work for you, and if you are serious about breaking your bad habits, you MUST replace them with new ones.
Believe me, it's not as easy as "receiving the Holy Ghost." I don't mean to be crossing any of the above posts regarding this, but one thing I know is if you are immersing yourself in His Word, you WILL receive the Holy Spirit because of it, most likely. "Seek ye first the Kingdom of God and all these things will be added to you." Matt 6:33
I don't think doing what I suggested is considered "works" as in trying to get to heaven by doing works. I think "working out your salvation with fear and trembling" is required. I'm sure if I am wrong, someone will straighten me out. lol
However, I've paid for my bad habit. In a way, it's a good thing, but I've found out I have to continue this good habit of staying in the Word, or else I fall back into temptation. It's sorta like an alcoholic . . . you have to stay away from places that serve drinks and replace it with other places in order to be successful. Stay busy, always be about your Father's business.
If you choose to accept this assignment, I'm confident that you will lick these bad habits. It will be hard work, but the rewards are outa this world! GBU