My niece used to sleepwalk also, one day a neighbor (3 houses away) rang my sister-in-law's doorbell in the middle of the night – she was "returning" their daughter (my niece) that had made her way into their patio. My sister-in-law was so thankful that she didn't wonder off further away or end up in bad hands, totally thanked the neighbor and started almost "baby proofing" the whole house. They did get a total house alarm but, knew this could be a hazard itself since you're not supposed to wake them up so along with the alarm came window locks, keyed deadbolts, baby gates and a good baby monitor she kept pretty much at her ear every night! My niece was all of maybe 5 or 6 at the time, she's now 12 and seems to have gotten over the sleepwalking now. I have two small children of my own, if either would start sleepwalking, I think I would definitely do the same. Not sure if this is "safe" but, I'd also consider maybe reversing the doorknob so that you can lock it on the outside of his bedroom? I know, I know… not the safest especially incase of a fire, or nightmares – I'd still use a baby monitor just incase of anything.
Good luck in anything you choose to keep your little guy safe.