It's a lose-lose situation no matter which side of the fence you're on. Whether it's your dog that's barking or your neighbor's pooch that won't stop flapping his jowls, nobody's happy ... including the dog.

But in most cases, you can't just tell a dog to hush. Trainers and dog behaviorists say that working with barking dogs is one of their most common requests. If your dog has a vocal problem, here are some tips that might help.

Why dogs bark

Before you can stop a dog from barking, it's helpful to understand why he's doing it. Dogs bark for all sorts of reasons, but it's all a method of communication, says certified canine trainer and behaviorist Susie Aga, owner of Atlanta Dog Trainer.

"It's an alert. It can be communication that someone's there. It can be to tell someone not to come closer," Aga says. "They have play barks, they have attention-seeking barks and they bark out of boredom. There are a lot of reasons, but it's all instinctual, primal communication."

Most dogs will bark if there's motion or sound — like a squirrel zipping across the lawn or a kid racing on his bike past the house. They might bark to warn off intruders at the door or other dogs that come too near the fence. Dogs might bark in excitement when you get out the leash to go for a walk or they might bark from stress when they have separation anxiety from being away from you. And some dogs just bark because they're bored and don't have anything else to do.

When you know the reason your dog is being so vocal, you can figure out the best way to quiet him.

Taking away the trigger

Labrador looking outside the window If your dog barks at things outside, close the blinds or move him to a room where he can't see what's going on. (Photo: Africa Studio/Shutterstock)

If your dog barks at things he sees out the window or front door, block the view. Close the blinds or curtains on the windows. If he can see out windows near the front door, Aga suggests covering them with darkening film you can buy from an auto parts store or even temporarily taping up some bubble wrap to block the view. If possible, confine the dog in a part of the house that doesn't have windows or doors.

If your dog barks at sounds, play music or leave on the TV to mask the noise. If he barks at passers-by or animals in the yard, don't leave her outside alone.

If your dog barks all day because he is bored, try leaving him with puzzles or games that take a while to figure out in order to get to the treat. If the dog's separation anxiety is intense, you may need to call on a trainer or behaviorist for more advice.

Making sure your dog gets exercise is always a great start. "A tired dog is a good dog and one who is less likely to bark from boredom or frustration," the Humane Society of the United States suggests.

Ignore the barking

When you hear yapping, it's only natural to chastise a dog to stop. But if you're pet is barking for attention, you're giving him what he wants, even though the interaction is negative, says trainer Victoria Stillwell of "It's Me or the Dog."

"In this case, it is best to ignore the barking, wait for five seconds of quiet and then reward him with attention," Stillwell tells The Bark. "This way, the dog learns that he gets nothing from you when he barks but gets everything when he’s quiet."

Similarly, she says, if your dog barks when you pick up the leash to go for a walk, don't reward him by heading out the door and giving him what he wants. Instead, drop the leash until he settles and stops barking. If he barks as soon as you clip on the leash, drop it and ignore him until he quiets down. It takes patience, but eventually he'll learn that barking won't get him what he wants.

Teaching training techniques

barking Australian shepherd dog If you first teach your dog to 'speak,' you can teach him to 'quiet.' (Photo: Aneta Jungerova/Shutterstock)

If you train your dog to "speak" on command, then you can then teach him "quiet." Next time your dog barks, say "speak" while he's doing so. Once he's mastered this, ask him to speak when he's not distracted then say "quiet" and hold a treat near his nose. When he stops to sniff the treat, praise him. Master this in quiet atmospheres, then try in more distracted environments such as after he's barked when someone comes to the door.

If your dog typically barks when someone comes to the door, ask him to do something else at the same time like a place command. Tell him to "go to your mat" and toss a treat on his bed at the same time the doorbell rings, suggests the Humane Society. He should forget about the barking if the treat is tempting enough.

Bark collars, citronella sprays and debarking

There are all sorts of devices that claim to stop barking. Most of them are some sort of collar that offer a negative response when a dog barks, such as an electric shock, a spray of citronella or a burst of static electricity. Talk with a trainer or behaviorist before considering one of these devices. If used incorrectly, they can cause more problems. For example, if your dog gets shocked every time he barks at a neighbor, he could associate the pain with the neighbor instead of the barking.

Debarking or devocalization is a surgery performed under full anesthesia that removes all or part of a dog's vocal cords. The dog can still make noise, but it's more of a raspy, hoarse sound. Many animal rights and veterinary groups strongly discourage the practice.

"I've never suggested it and I'm not a fan of it," says Aga. After debarking surgery, dogs often end up with trainers because they redirect the behavior into something destructive.

"It's still going to come out somewhere. You still have to do something to teach them how to deal with stimulation and movement and whatever was triggering them to bark in the first place."

Mary Jo DiLonardo writes about everything from health to parenting — and anything that helps explain why her dog does what he does.