Why do we attach intimacy to sleep? Whether it be sleeping with someone (in the literal sense of the word) or watching someone sleep, there's a feeling of intimacy fostered by these actions. It's not necessarily tied to modesty, because a person could be wearing shapeless, cover-all pajamas and be buried under several blankets and the intimacy would still be there.
I can think of two answers: one is tied to vulnerability and the other is tied to our animal natures.
First, vulnerability: when sleeping you're defenseless. People (or saber-tooth tigers) who have access to you in your sleep have the ability to harm you, so allowing someone to be there when you're sleeping is signalling a deeper level of trust, and thus signalling intimacy.
Second, animal natures: sleep happens in our personal animal dens that we verbally sanitize by calling them "beds." Whatever we call it, it's still an animal den. We go to great lengths to hide from each other the aspects of our animal natures (like how none of our myriad terms for "restroom" convey a sense of "this is where the defecation happens"), but the more intimate we become with someone, the more likely we are to end up having discussions about our stool. ("Nope, not me!" When was the last time you discussed your stool with someone who wasn't a doctor? Wasn't it with the person you'd say you are most intimate with?) Well, not only is the façade covering our animal natures dropped with those with whom we are intimate, a way of fostering intimacy is to drop that façade. As such, allowing someone to sleep with you, or to watch you sleep, or to know something about your sleep, is intimate.