I am sometimes solid – sometimes not. To keep you from harm is my aim, I run right around your home, but am always anchored to one spot. What am I?

A fence.

Source: Riotous Riddles