Keep villagers out of your house or base. Set a zone and villager AI pathfinding routes around it, so they stop using your doors and can't claim a bed or workstation inside. Wandering traders can be kept out too. No barrier blocks to place.