The subject says it all, but let me give you specifics. My tools may not be the same as yours, but the same principles apply.
1. Mobile Device
I have a recent Android device. I have turned off all audible notifications in all applications except for phone calls and SMS messages. That brings the notifications down to the '90s dumb phone level. With notifications off, I choose when I'm going to pull my phone out and check things, and my device only interrupts me for important communications (text messages and phone calls).
Delete the Facebook and Twitter apps. You can use Facebook from the browser, and it's more secure that way anyway. Replace Twitter with Twidere, which by default must be launched and the feed updated manually, though it will notify you of direct messages and mentions. Sign out of Google Hangouts. This ensures it only bothers you for text messages, and when you're off your computer, you're signed out of instant messaging and people know they either have to call you or text you if they want you.
I use a KDE-based Linux desktop (currently Manjaro), so you may have to adapt this. KDE has this thing called Activities, which let you group apps by function. Currently, I have only two: Desktop and Social. These are two separate screens that I have to Meta-Tab to switch back and forth to see. I know there are virtual desktop utilities for Windows, and I think the Mac lets you put apps on various screens now, but you're probably guessing where I'm going with this. On the Social activity, I have my email client (KMail) and my Twitter client (Choqok). My email client is set not to show a notification or play a sound when a new message comes in: that would be a distraction. Same with the twitter client (you have to set the system tray icon to Hidden to accomplish this).
Using an email client is important: if you use a browser tab, guess what? You'll see that little number in parentheses telling you how many emails have come in, and you'll then be tempted to check it. Don't use your browser. Use a client.
And while I'm on the subject of browsers, you should have two plugins installed: an ad blocker and a flash blocker. For those sites (like Slashdot) that you want to support, let the ad blocker show ads, but keep the flash blocker active so the ads don't become intrusive. It's easier then to read articles and such without the ads getting in the way. For most sites, block it all. And for heaven's sake, don't keep a Facebook tab open. Visit the site when you want to visit it, and then close the tab.
With this system, when I'm supposed to be focusing on work, I'm on my Desktop activity. I never receive a notification for email or any social network. If I have to use a browser in the course of my work, which is a frequent happenstance, ads and flash are blocked by default, and I don't mix it with my email.
Does this mean I miss stuff? Never. Like you, I realized I have an attention span problem that I didn't have in the past. That attention span problem induces me to check things on a regular basis. What I've removed is the interruptions: I'm probably going to check all those things anyway. That increases the amount of time I'm able to focus, and if I feel the need to check something, my email and twitter feed are a Meta-Tab click away.
What I have found is that I've been able to find that focus and "lose myself" in my tasks again. I am no longer interrupted all the time by things that have a lower priority than what I'm currently doing, and I'm much happier with what I'm able to accomplish as a result.
I hope this helps!