James Clear who wrote the incredible book, Atomic Habits, shares a similar philosophy to me on habit change. Willpower only goes so far, so setting up your environment is vital.
One of my favorite suggestions is a commitment device. You set up your environment so that you are forced to do what you want. His example—plug your router into an outlet with a timer that turns it off at a set time every night. Yes, you could go plug it in somewhere else, but what a pain. Most of the time, you'd just shut off your computer.
I do this with snacks at work, freezing the ones I bring, so I don't eat them too early in the day.
How can you make your bad habits really, really hard to do?