I hope you've learned at least one important truth as a result of your failures: You don't have the strength in yourself to overcome these bad habits. No matter how hard you try, their grip on you is simply too strong for you to break.
But who is stronger: you - or God? Even if you've never thought about Him very much or had Him as a part of your life, down inside you know He is stronger than you are - much stronger. And that's why you need Him, because He can help you by giving you the moral and spiritual strength you need to overcome these habits. After all, He made you, and He knows all about you. Not only that, He loves you and wants to help you - and He will, as you turn to Him and submit your life to Christ.
Begin by telling God exactly what you've told me: That you know you have sinned, and you know you need His forgiveness and help. Then ask Christ to come into your life and help you. He'll give you a new desire to live the way you should, and a new strength to resist temptation and do what is right.
Then ask God to show you practical steps you can take. Surround yourself with friends who will help you instead of pull you down. Flee from temptation when it first appears (not when its hold becomes too strong). In addition, fill your life with good things that will push out the bad. The Bible says, "Do not be overcome by evil, but overcome evil with good" (Romans 12:21).