Put the bed in a corner, with the head and one side against the wall. Then put a toddler bed rail on the other side. This leaves only the foot of the bed open. Get a baby gate for his doorway.
Do the usual routine the exact same way every night (bath, jammies, story and snuggle in bed) then tell him good night and that you want him to go to sleep now.
Put some pillows at the foot of the bed (so he feels cozy and blocked in a little), close the babygate, turn off the hall light and leave. He will get out of bed.

Give him some time, then tell him firmly, you need to get into bed. This will last for a while, but really he can't do much harm in his own room. He will probably fall asleep on the floor, for some reason kids sleep well on the floor. My 6 year old still does it 3 nights out of the week. Gradually, over time, it will get better. But the less of a "fight" it is, the sooner it will happen. Consistency is the key here, and containment.
Good luck, and remember that this too will pass.