I work from home, so focus is a constant struggle.
Music, caffeine, and good eating habits go a long way.
If I still can't focus after that then I probably wasn't meant to be focusing right then and I go do something else for a bit and come back.
Having multiple projects/pieces of work to do makes a big difference too. If one gets boring, switching to another for a few hours is often a good quick fix.