Anxious barking is caused by anxiety or fear, and often happens when a dog sees a “trigger” such as a stranger, another dog, or a motorcycle. To stop anxious barking, you must identify the source of the anxiety and either eliminate it (if possible) or train the dog to accept it. As with boredom barking, making your dog’s life more interesting and giving him or her many things to think about can help reduce anxious barking by reducing your dog’s overall level of stress.
When dealing with anxious barking, it is absolutely critical to avoid using aversives (shock collars, etc.), since these will only increase the dog’s level of stress. Instead, use dog-friendly methods, such as counterconditioning and desensitization (CC&D), to teach your dog to accept the triggers more calmly. You may want to consult a certified trainer to help you come up with the right plan for your dog. Bear in mind that for many dogs, there is more than one source of anxiety, and you will need to deal with as many of them as possible.
The best-known type of anxiety in dogs is probably separation anxiety. If your dog has separation anxiety and barks while you are out of the house, the barking will not stop until you teach your dog to feel comfortable alone. There are resources that discuss methods for dealing with separation anxiety, but it can be a difficult problem to treat on your own. Some dogs with separation anxiety need supplements or medication to help reduce their baseline anxiety while training is going on. If your dog has separation anxiety, I strongly advise you to consult a certified separation anxiety trainer.