A dog who barks every time you leave is likely suffering from separation anxiety, or has underlying behavioral issues that should be addressed. Take proactive steps to alleviate the problem before it becomes an ingrained habit.
You may have inadvertently taught your dog that if he barks when you're getting ready to leave that you come back and give him a treat, play with him or give him extra attention. This is reinforcing bad behavior, so if you're doing this, stop. When you do leave, stay in the vicinity for a short time to see how long your dog continues to bark after you're gone. This will help you understand if it's a short-term issue your dog overcomes within a few minutes, or if his barking is ongoing for long periods of time.
Condition your dog to your comings and goings by making several shorts exits and reentries. This will help your dog understand that even when you leave, you do come back. Don't reinforce barking by returning as soon as he makes a yip; instead, wait until he calms down before you come back in, and don't give him attention if he continues to bark, but rather, wait for calm, patient behavior. Instruct others in the household to back you up by following the same protocols when leaving the house.
Your dog may be barking because he misses you when you’re gone, or feels nervous or anxious about your departure. To help reduce or eliminate this condition, make sure you're spending adequate time playing with and interacting with your dog during your down time. Make sure he's not bored or lonely when you leave him. You may opt to hide kibble-filled toys for him to discover when you’re out or have a friend or neighbor check on him during your absence. Also consider leaving a television or radio on to provide ambient noise and company.
When to Call a Vet
If your dog doesn't stop his barking despite your efforts, or if you have complaints from neighbors that he barks excessively during your absence, consult your vet. Your pup may have an underlying health issue or a severe form of anxiety that can be appropriately treated with medication or behavioral conditioning.