I hope this helps, though I don't follow this advice for economic reasons:
- Have a silent and private place for you to work
- Have zero distractions
- Leave your phone out of that room where you work
- Block youtube and social networks.
- Use the Pomodoro technique. Work 25 minutes, rest 5, repeat.
- Every few pomodoro cycles, take a break, check your social media, then get back.
- The time you are at work, focus 100% on getting as much done in the least time possible.
- When you have accomplished some significative progress, take a rest, pat yourself in the back.
- When you feel anxious, take a deep breath or meditate.
If you are drinking caffeinated drinks, stop. I'm caffeine sensitive and it really makes a difference once I abstain from it, as an experiment. Give it a try.