Breaking the habit isn't the problem. How long you stay broken is.
Every time you do the habit, you cast a vote for the person you're becoming. Every time it breaks and you return within 24 hours, you cast a vote for someone who doesn't let breaks become endings.
You haven't been failing at the habit. You've been failing at the recovery. Fix the recovery — and the habit finally has somewhere to land.