Routine and persistence on the parents' part are the keys to a 2 year old staying in his/her bed. This will train a child as well as the parent! Habits will afford ecurity to both parties.
Give the child a "free pass" item that they can use to leave the bed once, and only once, during the night. They will likely fall asleep without using it.
This can be very tricky and I wish you the best of luck. I would TRY to first lay with your child until he or she falls asleep. Another is to give her/him incentives to sleeping in their own bed.