For me, one of the most crucial ways is to have a separate room where I do work. When I'm in my office, the door is closed. Our daughter is instructed not to interrupt me unless she's been told to do so. She leaves me alone to work while she's home.
When I come out the door gets closed again and it's family time.
I realize not everyone has this option, but for us, it's been amazing.