I played a lot of games a few years back. I just went "cold turkey" and stopped playing them. I would suggest finding ways to isolate yourself from them and make them hard to get to. You could try stuff like unplugging everything while you work so that you simply won't be in the mood to hook all that stuff back up until you're done working.
Music is different for everyone. I played a lot of chess and I met some people that could not play with music because it was too distracting to them while Others were ok with it. I only listen to instrumentals while working because lyrics tend to grab my attention.
And you could just turn off your phone and tv when you work.