If you move into an NPC village, most definitely. My group likes to build our homes inside a village, so we've built iron golems to protect us and the villagers. The wiki seems to indicate that they'll wander off if you try to put them near your home otherwise, though I've no personal experience with that. The wiki also says you can corral them with fences, if they do start wandering off, though of course fencing and adequate lighting prevents your home from being under attack in the first place.
Apparently you can also use vines to corral them, as they see vines as a solid block while you could walk right through. This could create an awesome hidden-grotto effect around your house.