As you write your book, if you face distractions that easily pull you away from your computer, schedule rewards for yourself. Tell yourself:
"Finish this chapter and then you can check Twitter or Facebook."
"As soon as you edit this next section, there's dark chocolate waiting for you."
"Work on this part you've been dreading and then you can take a walk."
Use those distractions as rewards. Turn lemons into lemonade.