1: I always try to build the roofstructure first, or a temporary roof if building with wood.
2: I place a lot of campfires around my buildsite (if on a live server) to scare away as many mobs as possible.
3: If I am later in the game, I build a protective wall around the buildsite!
Hope this helps :)