The space right under your bed provides your dog with a sense of safety. Since you are close by, your dog may feel that you are providing protection or that they are helping you to keep you safe while you are asleep. It all depends on the relationship you share during your waking hour.