Your bed smells like youa lotso your dog is hiding his scent in your bed.
By peeing in your bed, and hiding the smell of his urine, your dog is making himself feel less vulnerable and less exposed.
Some dogs are known as "submissive eliminators." Sometimes they'll even pee just because someone entered the room.