Let's talk about the notion that when you yell at your dog while he's barking that makes him think you are barking too.
True if you are just another pack member
False if you are a leader
This difference is important. And this is why some dogs don't listen to their people. You can read all the advice you want on how to train your dog but if he doesn't see you as the boss, he isn't likely to do what you say.
Not sure how your dog sees you? Hint. When a stranger approaches the front door and your dog barks and barks at the door, he figures he has to take care of this situation himself. If your dogs barks then looks at you, he anticipates your leadership.
Worried that you aren't a leader? It's not too late to exert leadership even if you haven't before. You'll have to boss your dog around. Trust me, he'll still be your pal when you are the boss.
How do you lead? Start simply. Make him sit before he gets a treat. If he doesn't sit, no treat. Keep that up and he'll get the message. When a leader gives a command it is obeyed.