Well actually, sometimes pilots do nod off!!! LOL!
Some of the really long flights can have one or even two relief pilots allowing break times to be established. The crew can then make use of crew rest facilities located onboard.
On other flights where there may only be two pilots but the flight is particularly long the pilots can have "controlled" rest in their seat. Here the pilots will decide amongst themselves who will have a short shut eye in their seat. Generally guidelines are put in place by the cabin crew so that regular checks are made to the flight deck to make sure both have not nodded off at the same time!
But other then that there is very little to do up there when its quiet, read all the newspapers, do all the crosswords, EAT, drink numerous cups of tea, get up for a stretch and a pee break, annoy the cabin crew in the galley by getting in the way for a few minutes, put the worlds wrongs to right etc etc!