When we moved my son from cot to bed we gave him a 'sun clock' so he knew when time to call for us. We left the gate in his doorframe so he could 'open' the door but not wander around the flat.
We gave him a star for each evening that he stayed in bed and a new special stuffed animal for his new bed. I also set up a potty (with bathmat) in his room so he had an en-suite if he needed it so he didn't require leaving his room.
We were lucky that he was a pretty compliant child though I do not expect the same results with my crazy daughter (we are about to transition at 34 months now that she is potty trained).