Ignore him, totally. Dogs perceive any attention, whether its negative or not as better than no attention at all. What they don't like is being ignored, so the best way to stop behaviour you don't want is to ignore it. It's one of the hardest things you can do, ignore a persistently barking dog that's driving you round the bend, but it is the best way of curing him. Whatever you do, don't shout at him, he will not only take that as a notion that you are awake and responding to him, he will think your shouting is you joining in, encouraging him, and he will actually bark more to outdo you! And the more/ louder you shout, the more/ louder he will go!
So you need to do the opposite - teach him that barking gets him nowhere and has no affect whatsoever. Next time he barks, pretend there's no dog there and you can't hear a thing. Oh and he'll know if your not convincing enough, so you have to put on an oscar winning performance! Don't speak to him, don't touch him, don't even look at him, do not in any way acknowledge that he's there, let alone making a noise. Once he realises that you don't respond to him in any way whatsoever if he barks, he will stop, because for some strange reason you can't seem to hear him so its pointless doing it

.
Some dogs learn it quickly, some take more time, and it depends how long they've been allowed to get away with it for, but as long as you ignore him
every single time he barks, he will eventually realise that it is not the way to get your attention, it might have worked with his last owner, but not you. Just to warn you, you might want earplugs for a bit, because when you first start this, the chances are he will be worse than ever for a bit, as he won't understand why your suddenly not responding and will try even harder to get your attention. Didn't give in - its better to have a week or so of no sleep than years of getting up at 3am

.