1 - Use positive reinforcement.
When you reward a desired behaviour with treats and praise, your dog becomes incentivized to repeat it. Here are a few examples:
Teach the “Quiet” command.
When your dog starts barking at an inappropriate time, tell them “Quiet” in a calm, firm voice. Once they stop barking—even if it’s only to catch their breath—provide them with a treat and loving praises. Keep doing so, and they’ll eventually associate the “Quiet” command with treats. This technique has the benefit of working in multiple situations, at home or outside.
Get your dog to lie down instead of barking.
Move your dog’s crate or bed somewhat near the front door. Use a treat to entice your companion to lie down. Praise and pet them when they do so. Once they get the idea, open the door and immediately toss a treat on their resting spot. Keep praising and rewarding your dog each time they lie down. Continue adding new elements (i.e., knocking, ringing the doorbell, having someone else come in, etc.) until your dog learns to lie quietly whenever someone is at the door instead of rushing to greet them.
2 - Use operant conditioning.
Operant conditioning allows you to modify your dog’s behaviour not only by reinforcing good manners but also by discouraging undesirable behaviours. For example, you could:
Close all the blinds and windows.
While indoors, if your dog barks whenever another dog, a cat or a squirrel walks by, close all the blinds and windows to limit what they can see. Do so every time you leave the house, and open them only while you’re home and your dog remains calm and relaxed.
Ignore your dog’s barking when coming home.
If your dog greets you excessively, don’t reward this behaviour by praising or petting them. Instead, ignore them, remain silent and don’t make eye contact until they stop barking and sit quietly. Only then should you acknowledge their presence and interact with them.
3 - Keep your dog tired.
By tiring your dog through exercise or a vigorous play session, you’ll make them feel more like lying down and resting rather than running around and barking. Try taking your four-legged friend on a brisk, early morning walk before you leave for work, or challenge them to an intense tug-of-war session just before guests arrive.
General training advice for dog barking