Minecraft wiki entry for Safe_home, associated text: Build a ditch deep enough that the mobs who fall in can’t get out anymore, which is either filled with lava or streaming water leading to a Mob Farm.
Keep your home area well lit. Mobs only spawn if the light level is below 8; remember that a torch provides level 14 light and this decreases by one for every block away from the torch. Lit netherrack works well, since it doubles as both a light source, and a means of setting mobs on fire, although there is also the risk of setting yourself on fire. So if you do want use this method, bring a bucket of water.
Another way to keep mobs out of your house is a staircase that has an overhang.
If you are in single player, a door made of pistons keeps you hidden from mobs almost all the time. Place 2 pistons facing the outside. Then, place a lever right next to both of the pistons backs. Next, turn off the pistons, go outside, then make an arch around the spot where the pistons would stick out. Finally, where the pistons would stick out on the sides make a tunnel to your base. Make sure you can walk through it. When the pistons come out, the mobs can't enter, and skeletons can't reach through your door. Another good way to protect yourself from most Overworld mobs is to create a long hall with a lava floodgate to burn mobs. This can be done with both pistons, or dispensers containing lava buckets. This will not work on Nether mobs.
Mobs cannot spawn on stairs or bottom-half slabs. Make roofs, catwalks, and even floors out of these to prevent mobs from spawning there.
Elevate your base and use ladders to reach the entrance. Mobs (except spiders) cannot climb ladders.