The more distractions that go on around you, the easier it is to forgo your work to look at them. Your brain hears a ding or sees a notification about an email or a missed message, and it assumes that the information is important, and needs answered right away. Of course, this is usually not the case and is just an easy way to distract yourself.
If you want to improve your focus, then you need to create a focus haven around where you plan to work. Cut out the noise and any distractions that often get in the way. Not sure what those distractions are? Take note for a few days and see what items and sounds tend to pull your attention away when you are supposed to be working.