We have a beagle. Used to go an annoy the neighborhood by getting into a barkfest with the neighbors dog when let out in the back yard. When we let him out in the backyard we put a collar that emitted a high frequency noise everytime he barked. We could barely hear it, but his ears went back everytime it went off.
About 10 days, no more barking in the backyard.
Still barks his fool head off whenever someone/thing gets within ~100 ft of the house, but I can live with the false alarms.....