You put your dog out, close the door and sit down. Within 30 seconds there is barking at the glass, and the neighbours can hear every bit of it.
This is the opposite of a dog who will not come in. Your dog is not refusing the house. They are refusing to be out there without you.
Why the garden alone is not a reward
The garden is a place your dog normally visits with you in it. Take you out and what is left is a fenced square where nothing happens.
For some dogs that is dull, and barking is the most interesting thing available. For others it is genuinely uncomfortable, especially after dark or with a dog barking next door.
What the barking pays
Watch what happens after the third bark. The door opens. From your dog's side that is a clean result, and it will be tried again tomorrow.
Do not open the door while your dog is barking at it, unless they are frightened. If they are, open it and stop the plan for today.
Do not go out to tell your dog off for barking. You arriving is the thing they asked for.
Stop putting your dog out to get them out from under your feet, for a fortnight.
Go out with your dog for toilet trips in the meantime, so nobody is rehearsing the barking while you work on it.
A bark collar is never a step in a Halfgrown plan. Punishment-based approaches are associated with fear, avoidance and defensive aggression, and aversive methods carry no training advantage.
Build solo garden time in seconds
Gradual practice, short enough that your dog never starts to worry, is the core of this kind of work. At the back door it looks like this.
Go out with your dog, scatter a handful of food in the grass, and stand there while they find it.
While they are still eating, step inside and close the door for 5 seconds. Come back out before they look up.
Repeat 6 times. If your dog reaches the door before you get back, the gap was too long.
Add 5 seconds at a time across a fortnight, and do 6 short absences rather than 1 long one.
Expect days that go backwards. Drop to a gap your dog can manage and carry on from there.
Working below the threshold at which your dog reacts is the condition for learning. The whole plan is coming back before the first bark, over and over.
Make the outside worth being in
Scatter part of a meal in the grass every time your dog goes out alone, so going out starts to predict food on the ground.
Keep one chew that only ever happens outside, on a mat or an old towel by the back step.
Walk the garden with your dog for 1 minute first. A dog who has already checked the fence line settles faster than one who has not.
Keep the door you will come back through in sight while the gaps are still short.
If this is worry rather than boredom
Barking that starts before you are even through the door.
Pacing the glass, scrabbling at the door, or a dog who cannot eat the scattered food at all once you are inside.
Barking only after dark, or only when next door's dog is out.
A dog who is still barking 10 minutes later, at the same rate.
That version does not improve by holding out. Stop leaving your dog out alone, go out with them, and treat it as alone-time work rather than garden work.
If a neighbour has already mentioned the barking, say plainly what you are doing about it. That is a separate job from the training, and both of them need doing.
Behaviour change is built from management plus reinforcement together, and reward-based methods are what is recommended for behaviour change. The management is going out with your dog for a fortnight, and the reinforcement is food in the grass.
Safety note
Get help now if your dog panics out there. That means bolting, going through a gate or a fence, scrabbling until they injure themselves, or barking without let-up. Speak to your veterinarian and a qualified behaviour professional who uses reward-based methods. Sudden behaviour change warrants a veterinary examination, and pain frequently presents as a change in behaviour rather than as obvious lameness.
Today's version, in one line: scatter a handful of food outside, step in for 5 seconds, and be back before your dog looks up.