Have you had him since he was a small puppy? If not, do you know his early history? My first thought is that maybe he was abused as a puppy. If the abuse involved small spaces or being cornered, he might get nervous in situations like that. Being in the dark would just amplify that feeling. Maybe you could introduce him to small spaces, that wall next your bed, and the dark under good circumstances – being fed his favorite treats and being petted and loved. Start off with the light on, and when you think he’s comfortable there, then turn the light down and keep loving him. If you show him he’s safe and can associate that situation with good things, he’ll be less nervous.