When it's time for your toddler to go to bed tell them sternly that's it's bedtime and that he/she needs to go to sleep and stay in their room.
Don't laugh or smile or anything of the sort when putting your toddler back into their room. Tell them that it's time for bed and they're to stay there all night until morning.
Try keeping a set time that your toddler gets a bath, diaper change, etc and then put them to bed at the same time each night so that a routine gets set.
That way they'll get used to the certain time being bed time.
If all else fails you may have to resort to locking your child's door from the outside. My sister had to do that with my nephew because he kept escaping from his room when he was 2 years old and was wandering around outside.
She hated to lock him in his room but had no other choice. And it was just for overnight and then she unlocked it as soon as she got up.