M.M.
We were in this EXACT situation 6mos ago. I feel your pain. DS kept us up coming out of his room from 12:30-4:30 one night. No chance.
We also have lever handles on our doors, so we just reversed them, so the lock is on the outside. Yes, we lock him in his room.
We don't leave him to scream behind a locked door. We do go to him when he cries. But after a few days of us tucking him back in after he tried the locked door, he understood that locked = night night. It's a beautiful thing.
I've had someone out here call me incredibly lazy for not simply walking him back to bed each time. 1) this worked for our family, and I work full time AND have a newborn. So being up all night walking him back to bed is not an option and 2) MANY people I know do exactly the same thing.
We had tried bed rails (he'd climb around), a gate (he'd climb over), I think crib tents are ridiculous, and my favorite that someone else suggested...."just explaining to him that he sholud stay in bed"...if your kid is anything like mine, you might actually SEE him give you the finger.
Figure out what works for you. A gate, a handle lock, reversing the knobs, something.