Optimized version:
# turn on
sudo rm /etc/hosts
sudo ln -s /etc/hosts{.work,}
# turn off
sudo rm /etc/hosts
sudo ln -s /etc/hosts{.play,}
Optimized further (in your ~/.bashrc):
alias work="sudo rm /etc/hosts && sudo ln -s /etc/hosts{.work,}"
alias play="sudo rm /etc/hosts && sudo ln -s /etc/hosts{.play,}"
Optimization cubed (lets you define a base hosts file):
alias work="sudo rm /etc/hosts && sudo cat /etc/hosts.base >> /etc/hosts && sudo cat /etc/hosts.work >> /etc/hosts"
alias play=...
The number of upvotes, the fact that you thought this was necessary and the fact that this application exists all made me facepalm hard. I can't even see right now.