The Scientific American site had an article by M. Shermer on sensed presence effects. (here) He puts forward a list of possible causes:
Whatever the immediate cause of the sensed-presence effect, the deeper cause is to be found in the brain. I suggest four explanations: 1) The hallucination may be an extension of the normal sensed presence we experience of real people around us, perhaps triggered by isolation. 2) During oxygen deprivation, sleep deprivation or exhaustion, the rational cortical control over emotions shuts down, as in the fight-or-flight response, enabling inner voices and imaginary companions to arise. 3) The body schema, or our physical sense of self—believed to be located primarily in the temporal lobe of the left hemisphere—is the image of the body that the brain has constructed. If for any reason your brain is tricked into thinking that there is another you, it constructs a plausible explanation that this other you is actually another person—a sensed presence—nearby. 4) The mind schema, or our psychological sense of self, coordinates the many independent neural networks that simultaneously work away at problems in daily living so that we feel like a single mind.
Neuroscientist Michael S. Gazzaniga of the University of California, Santa Barbara, calls this the left-hemisphere interpreter—the brain’s storyteller that pulls together countless inputs into a meaningful narrative story. In an experiment with a “split-brain” patient (whose brain hemispheres were surgically disconnected), Gazzaniga presented the word “walk” only to the right hemisphere. The patient got up and began walking. When he was asked why, his left-hemisphere interpreter made up a story to explain this behavior: “I wanted to go get a Coke.”