M.M.
I went through the same thing with my two children. I have a good routine before bedtime first then I use a technique that is both calm, yet shows my children that I expect them to stay in their bed.
Whenever, either of my children get out of their beds, we lovingly take them back to bed. The first time they come out, we calmly say, "It's bedtime sweety and we love you. We already had kisses. It's time to sleep." Then walk them back to bed. The second time when either came out of their rooms, we calmly say, "It's bedtime sweety." Then walk them back to bed. The third time and there after, we say nothing still calmly walking them back to bed. After about 30 to 60 minutes the first night our children stayed in their beds. As days progressed, the time keeping them in their beds decreased, until only occasionally do we have to walk them back to their beds, reminding them its bedtime.
It takes time, but its a calmer approach than to lock them in their bedrooms. In fact, if I were you, I would not lock children in their bedrooms, because it may satisfy you; but children become scared. My husband was locked in his bedroom as a child and now has great difficulties going to sleep at all. What you do now will impact how a child will sleep when he or she becomes an adult.
The whole aspect of the technique I use, is to let my children know my expectations and that I remain calm; because Im sure you can agree that if your not calm yourself when you go to sleep it is hard to get to sleep even as an adult. It's triple the effect with children. They can't sleep if they are not calm. On top of having two children, I have a Master degree in Child Development. I hope this helps. M.