Your dog is not housebroken. A housebroken dog will not use your house as a bathroom, and they won't pee in your bed out of spite. Only if the dog is kept inside for a prolonged period or is sick should a housebroken dog EVER relieve himself indoors.
You have to watch them every second and crate them when you can't. I first suspect as a male he's marking his territory, but you have to make him understand that is not acceptable.
If he heads off to the bedroom, you better follow him, fast. It only takes a second at that age to soak a big spot on your bed.
He may be giving you signs that he needs to go out, but you're missing them. Every dog is different and will let you know in their own way.
Some go to the door. Some will come to you and sit and look at you. Lisl will come to me and whine. Ossie would lay his head in my lap and look at me. Anna would go to the door. They're all different.
I wish I had better advise, but I have not housebroken two dogs the same way. Sure the techniques might be close, but the methods have to be adapted to the dog's personality. I can't better put that into words. In many regards, it's a matter of 'feel' when training a dog for housebreaking or anything else with me.
Bear, Anna, Molly, Ossie, and The Countess Lisl von Schlaf
An Unhappy German is a Sour Kraut!