One of the things I use for Firefox is the add-on LeechBlock. I set up all kinds of block lists and then set it to block me from changing the settings within certain time limits.
It works great for the most part... Except then I pull out my phone and get distracted there as it's harder to setup such a system there.