The Hitchhiker's Guide to the Galaxy has this to say on the subject of sleep:
Sleeping is a mostly enjoyable activity which is also a biological necessity of most species across the galaxy. While some societies look down upon excessive sleeping as a form of laziness, they are in fact terribly wrong. Sleep is a brilliant way of regaining energy, signaling the end of a long hard day, and avoiding the universe. It is not unlike a commitment-free version of death.
Arthur Dent has never read the Guide's entry on sleep, and if someone were to come to his room in the Heart of Gold, where he was having a great deal of trouble sleeping one artificially-induced night, he would not have appreciated it. In fact, at hour of the night, which might have been deemed "ungodly" on Earth (as so many late hours of the night were deemed), no interference with his futile attempts at sleeping would have been welcome. He currently lay in his bunk, curled up in fetal position as its size required him to do. It was not built with people of his height in mind, and the way this fact nagged at him posed yet another difficulty in his achieving a restful state.
Arthur tossed and turned and pulled an uncomfortable blanket tighter around him. He had no idea why he was initiating closer contact between him and an uncomfortable object, but it was one of those nights where he had no idea of anything. He didn't even know why he couldn't sleep. It wasn't as though any difficult questions about life, the universe, and everything were nagging at him. And it also wasn't as though he was experiencing any emotional turmoil over the tremendous difficulty he was having with his lifestyle. He wasn't even awake wondering why he was still awake. Truth be told, he had had some infrequent trouble with falling asleep back when he lived on Earth (back when there was an Earth to live on), and the only way in which things had changed now that he was living in the more chaotic galaxy-at-large was that he now had frequent trouble with falling asleep.
The unfortunate sound of footsteps came from down the hall, serving as another distraction from his frustrating problem. He let out an involuntary groan and curled up, turning his previous fetal position into something more comparable to a worried hedgehog. The footsteps would pass, he hoped, and whoever it was would just walk past his room and not invade on his pitiful attempt at sleep. But the door opened with a contented sigh, which simply added insult to what he felt was injury.
The footsteps stopped. Someone hovered over Arthur where he slept. Arthur closed his eyes tighter and lay perfectly still, hoping that whoever it was would think he was asleep and go away, much like opossums lay perfectly still and hope that their would-be predators think that they have suddenly expired. Arthur hoped that his would-be botherer would think that he had suddenly fallen asleep.
It was to no avail. The would-be botherer remained where they were, and Arthur decided the direct approach was now the only approach.
Arthur Dent opened his eyes and sprang out of bed. He was going to yell, "I'm not sure why you've chosen to come bother me at this time, but I'm trying to sleep and it hasn't been going very well, so if it's all the same to you, I'd rather you leave!" He didn't even make it halfway through that sentence, however, because he saw just who it was hovering over him.
"Oh. Ford. It's you."
"Yes," the Betelgeusian said neutrally. "It's me."
Arthur stood, staring at him. "Why are you here?"
"Well, I was having trouble sleeping myself, so I thought I'd come here and see if you were having trouble sleeping, too. If you were, I'd stay here with you and try to occupy myself with your company. If you weren't, I'd wake you up and then try to occupy myself now that I had your company."
"I see. Well, those were some awfully considerate plans, especially the second."
"And since you're up now," Ford said, ignoring the sarcasm, "I suppose we can occupy ourselves."
"And how do you suggest we do that?"
A pause. "I'm not entirely certain. I hadn't gotten that far along in my planning."
"Oh. Alright, then." Arthur started pacing about the room. When he got tired of pacing, he leaned against one of the room's walls, let out another groan, and sank to the floor, sitting with his legs pressed up as close to his body as they could possibly be pressed. He wrapped his arms around his knees and pressed his face into them. If this wasn't a clear example of body language that said "please leave me alone", he didn't know what was.
Unfortunately, Ford did not have the same grasp on body language that Arthur did, and he somehow thought that sitting down next to Arthur and looking over at him quizzically was a good idea. He began to have a few thoughts of his own, mostly regarding Arthur's behavior and what it signified. He hadn't seen Arthur do anything like this, and he hadn't seen any other humans do this, either. Was this something humans generally did when they were tired and couldn't sleep, or was this a quirk specific to Arthur? He considered asking his companion, but he decided against it as he didn't much see the point in it anymore.
Presently, Arthur raised his head and looked over to the other man. "Ford. If it's all the same to you –"
"Which maybe it isn't."
"– but hopefully it is…I'm going to get back in my bunk and attempt to sleep again. I don't know about you and the rest of your kind, but I am a member of one of those species in the galaxy who need sleep."
Ford was clearly not getting the hint. Arthur shook his head and trudged back into his sleeping space. He lay down with his hands under his head like a pillow, his legs curled up in the worried hedgehog position again, his eyes staring out insistently at his friend.
"So I'm going to sleep," Arthur said. "Goodnight, Ford. I'll see you in the morning, probably."
"There's no morning in space," Ford said.
"I'll see you in space's rough equivalent of morning, then," Arthur said. "Goodnight."
He closed his eyes, hoping Ford would go. For a moment, nothing happened. Then, after a second or so, nothing continued to happen. It was a rather long moment, and Arthur, who was by this point actually feeling slightly tired, assumed Ford would have gone by now. He turned over semi-confidently, only to feel a hand on his arm.
"Ford!" Arthur performed an action that was somewhere between sitting up straight and flipping his body to face the side he had not previously been facing. "I thought you had left!"
"No, I hadn't left," he said. His expression and voice let Arthur know that he was genuinely puzzled. "Why would you think I had left?"
"Well." It was going to be another one of those times where he had to explain something rather uncomplicated to Ford in the sort of oversimplified clarity one might use to explain how an airplane works to a particularly dense acquaintance (assuming, of course, one understands how an airplane works and has a particularly dense acquaintance who wants to know). "I expressed my desire to sleep, and sleep is not a thing that requires other people's involvement."
Ford flashed one of his typical grins. "It could."
"Yes. But in this case, it – wait. What are you trying to say, exactly?"
Arthur found himself being pushed over as Ford joined him in the already cramped sleeping space. He pushed against Arthur's side, making his presence very obvious and definite. Arthur was about to ask him to get out, due to the fact that the presence of another person sleeping with him wasn't very conducive to his own sleep, but he didn't because he had to admit that, if he was going to have to share a bed with another person, Ford wasn't a bad choice.
"Ford," Arthur said, slightly irritated. "Could you please move your arm? I don't want it lying across my chest like that."
"Fine." Ford complied by changing its position, curling his arm around Arthur's. This wasn't entirely the sort of correction Arthur had had in mind.
"You know, you could have…oh, never mind. What's the point."
"The point" was that Arthur didn't sleep very well when faced with such distractions as another person touching him or even sharing the same sleeping space as him. It was much like picking up the ends of a scarf and attempting to wrap it around your neck instead of putting it on in a more typical manner. It could probably be done, yes, but he wasn't entirely sure how and he knew it would probably fail miserably.
He wished he could have explained this to Ford, but he didn't suppose the alien man would get the point trying to be made. Besides, Arthur, despite himself, liked how cuddly Ford was getting with him. He would have liked to respond by turning over to face his companion, stretching his arms out, and pulling him closer, burying his face in the shorter man's hair and perhaps running his fingers from the start of his neck to the base of his spine. It would have felt very nice, yes, and Ford probably would have agreed. It just wouldn't have helped him get to sleep.
Irritated, both with Ford's interruption of his attempt to sleep and how welcome the gestures would have been at practically any other time but this, Arthur folded his arms across his chest, thus yanking Ford's arm from his own. Ford retaliated by throwing said arm around Arthur, snuggling into his body from behind. This was, with no doubt, retaliation. Or at least, it felt like retaliation. Probably it wasn't, and probably it was just the result of the sort of paranoia almost everyone feels at ungodly hours of the night when one ought to be asleep but isn't. But Arthur could not shake the feeling.
Sighing with contentment, Ford pulled Arthur just a little bit closer. Sighing with frustration, Arthur turned around to face him.
"Ford," Arthur said sternly. "Are you attempting to retaliate?"
"Yes. Are you attempting to get back at me for removing your arm from my chest?"
Ford didn't answer right away but gave Arthur a contemplative look, like he himself was trying to find the answer to that question. "No," he said. "Not as such, no."
"Then why, when I tell you that I want to sleep, are doing everything in your power to keep me from sleeping?"
"What?" At this, Ford rose to look over at Arthur, brows furrowed, head tilted, and mouth twisted into a genuinely confused frown.
"Yes," Arthur said, looking up at Ford, returning his expression with a similar one. "All the touching. The hugging. The putting your arm around me right after I remove it from my body."
"You mean that doesn't help you?"
"No, it doesn't. You mean you actually thought you were helping me get to sleep?"
"Well, it was helping me get to sleep, at least."
"Ah, yes. I had forgotten how, when doing something that helps you, you tend to forget that it might not have that same effect on others."
Ford made no apparent notice of this accurate description. He just sighed and turned over so that he lay on his back, staring upwards at nothing in particular. He opened his mouth as though to say something, and it almost seemed as though he was trying to form words that would sum up the situation, but he abandoned the pursuit and shook his head. Arthur attempted to assume a position similar to Ford's, but the bed was, as he now remembered, too short for him to stretch out the full length of his body as was required for this position and as Ford was short enough to do. He attempted to make some loose approximation of it, but it wasn't working, and he resigned himself to lying on his side again, facing the wall, arms folded in frustration. Everything was frustrating tonight. The fact that he couldn't sleep, the fact that he was lying in a bed with his friend from Betelgeuse, the fact that said friend was having trouble keeping his hands off of Arthur, the fact that he would be alright with this if he weren't trying to sleep, the fact that the bed was too short for him to maintain any position that didn't bring to mind a worried hedgehog. It was all a source of frustration.
They lay together in silence. Ford said nothing. Arthur said nothing. Ford again said nothing. Arthur again said nothing. They both said nothing together.
Then, finally, as though the buildup in that prolonged silence was in anticipation of this moment, Arthur said something.
The thing he said was, "Damn it, Ford," as he turned over to face his companion, stretching his arms out and pulling him closer, burying his face in the shorter man's hair and, as he had previously imagined, ran his fingers from the start of his neck to the base of his spine.
"Oh, what's brought about this sudden change?" Ford said, fully embracing it.
"I'm not going to fall asleep no matter what either of us do," Arthur said, running his hand through Ford's hair. In the entire history of the universe, probably no one has run their hand through someone else's hair in a more agitated manner. "If I must stay up all night –"
"There's no night in space," Ford reminded him.
"Alright, if I must stay up for the entire length of time I'm supposed to be asleep, I may as well stay up doing something that pleases me instead of lying there like…I'm not sure like what, but like something."
"A worried hedgehog?"
"Yes. We may as well describe it as such. A worried hedgehog."
Ford laughed. Apparently, this description amused him. He drew his worried hedgehog closer to him. "May as well do something you like when you can't sleep."
Arthur continued to stroke Ford's hair like one strokes a cat in the hopes that the contact initiated with the pet will somehow improve the situation and lessen the anxiety. Arthur wasn't actually expecting this to improve the situation or lessen the anxiety, but he decided he may as well do it.
As the night – or the outer space equivalent thereof – wore on, Arthur found himself doing something very unexpected. Not only did he gradually feel less tense, he actually began to feel somewhat sleepy. Even though he was definitely engaged in physical contact with another person, it seemed to be helping him. Perhaps he had actually wanted or needed this without realizing it before.
Arthur had, as of now, tired of the hair-stroking and was now simply content to lay with his companion in his arms. It presently became clear that Ford had fallen asleep, judging by his current behavior of snoring. With one hand, Arthur held Ford's face, and with the other, he brushed away the hair from the other man's forehead. Upon this cleared space, Arthur planted his lips, giving Ford a good-night kiss. It was with this that Arthur was finally able to drift off to sleep.
What the Hitchhiker's Guide to the Galaxy doesn't say about sleep is that, if one is having difficulty falling asleep and one loves anybody in particular, it is sometimes useful to fall asleep in the arms of whomever it is one loves, particularly if the other person is having difficulty falling asleep as well. Falling asleep, as it turns out, is sometimes easier in a loved one's arms.