I agree that the first thing to do is modify the crib or put him in a low bed or SOMETHING to make sure he's safe when getting out.
We just went through this with our 28 month old. We moved his bedtime back half an hour, then sat on the stairs outside his room and every time he got up, we'd go in and say, "Time to go to sleep. I love you." and put him back in the bed. We stayed calm and he was never upset... he'd say, "Okay, Mommy!" then pop back out 10 minutes later.
But eventually he got the idea and after about a week of this, he was back in the crib.
I read that you shouldn't say anything or engage at all but that just wasn't possible for me. I wanted to say SOMETHING so he'd know all was well and that we weren't upset. Seemed to work and felt gentler to me.
Edited to add, I think the key is to stay calm. If it takes 20 times the first night, so be it. Sit outside the door with a book and a small light or something. It will take fewer and fewer times each night. As a side benefit to this, our son had stopped napping on weekends even though we KNEW he was tired. We used this approach at naptime as well and he's napping well again.