Hi P.,
We transitioned my son to his "big boy" bed around 20 months. We had a similar problem where he just kept coming out of the room. For the first week or so, everytime he came out of the room, we would pick him up and take him back to his bed. The first few times I told him he needed to go night-night. After that, I stopped even talking and would just put him back in bed. Many nights it took 10+ times for him to stay in his room, but we were persistent and never gave in.
After the first week of doing that, I figured he understood that mommy and daddy wanted him to stay in his room. At this point, it had become more of a game for him. We put the baby gate up in the hallway and put a child lock on the bathroom door. That way, he could still be in either his room or ours but was safe. I went downstairs right away and let him cry it out. It only took about 2 nights of this and he stopped even trying to come out of the room.
After a month or so, he started coming out again, but would not cry and he now falls asleep in the hallway every night. We put him back into his bed when we go upstairs for bed and he will then stay there all night.
It just takes some patience and persistence, but it is a very doable thing at this age. Best of luck!