Exercise, Exercise, Exercise. When our dog was a puppy a lot of exercise would increase his chances of sleeping quietly.
We kept Ranger in a crate in another room. So, we just ignored his night time barking like this...
4 months 4-5 hours in crate, then outside
5 months 5-6 hours in crate, then outside
6 months 6-7 hours in crate, then outside
7... I think you get the idea.
It worked for us because I'm a night person and my husband is a morning person. Early on I would let him out at midnight, then my husband would take him out at 4am. Then we stretched this time out, I can't remember exactly, I think by 30 minute increments? ?? My husband would make a point of waking Ranger up, or waiting until he was quiet for at least 3-4 minutes before getting him out of his crate. This wouldn't work for everyone. But, it kept Ranger on a comfortable "Business" schedule, and just happened to work out with our sleeping patterns.
Because Ranger received zero attention for his barking, he stopped trying it out. But not immediately. He would be quiet 2-3 days in a row then try the barking routine again. Eventually, he learned. But it took him some time to get it down.
When we increased his time and after he moved into our bedroom he would wake up @4am and try to coax us into letting him outside, to play. He didn't have any business to do. So, we began ignoring him. He's 2 now and he sleeps in our bedroom on his own little bed. Once in a blue moon he'll wake up @4am and play bow while imitating Chewbacca. It's hard not to burst out laughing.