Does the door open into the room? You could put the baby gate into the door frame of his room.
@Mirka for some reason I didn't think of that 😅 but I'm 35w pregnant atm so its probably just mommy brain I was thinking the door couldn't close then, but it might fit 🤔
By the way, the railing isn't a concern at this point.