What helps me is well-defined tasks. I put them in Trello and prioritize them. I tell myself that I can not go to another task without finishing a previous one. I also tell myself the sooner I finish the more time I will have for myself. I think the first steps are about discovering what works for you and what does not.
I don't think you will fix this problem instantly. It will take time, so don't panic. Also remember that some days you are gonna be less productive than usual, don't be hard on yourself then.