Make sure you have no holes on your walls/cieling and also do not have any platforms leading inside!
During a blood moon i like to place one dirt block on either end of each door leading inside, the zombies won't be able to get in!