Be persistent and patient. I made the mistake of letting my oldest sleep with me until he was 3 and it was a pain to get him to sleep in his own bed. I kept having to put him back to bed when he tried to come back to my bed. Maybe put a night light in there.
Put him to bed, walk out and make him stay in there. If you have to sit outside the door then that's what you need to do. If it takes a wekk then it does, if it takes a month then that's what you have to do.
I have always kept a routine with our boys. Bath at 7pm, story, and then lights out at 8pm. Every night no matter what.