To Prevent Small Children from Leaving the Home Unsupervised
Easiest and best: Sleep when your child sleeps and stay awake when your child is awake.
Install a sliding bolt or deadbolt near the top of the door, high enough so that your child cannot reach it even when standing on a chair. A less expensive (but still effective) alternative is the hook & eye clasp.
In extreme cases (when children are able to unlatch locks that are high on a door), have alarms installed. This can become expensive, but may be worthwhile for a child who repeatedly wanders.
Use an electronic monitor (the conventional baby monitor); put the transmitter in the child's room and keep the receiver with you as you move about the house.
For smaller children, use infant gates to block off rooms. These are even useful on porches.
For children who are too young to communicate or who have developmental delays that prevent them from communicating, mark their clothing with the child's first and last name. This will assist law enforcement or Children Services should the child be found wandering.