Pause for a while and think about your relationship with your dog - maybe it is you who has been trained by your dog, and not the other way around. As responsible dog owners, we should know where to draw the line between spoiling our dog with everything he wants, and just giving what is best and enough for him.
Some dogs get spoiled too much; owners give in to almost every demand of the dog that the dog mistakenly believes that it is he who is the boss of you. When your dog has the mindset that he is the boss of you, this may unfortunately lead to some unwanted habits and inappropriate behaviors, such as excessive and inappropriate barking, in the future.
When your dog acts like he is the boss of the house, do not give him reasons to think that he can take the lead role. It may sometimes be really difficult to resist our adorable dog best friends, but it is important to not give in and follow all the time their rules and demands. However, of course, still give your dog enough attention and care that he needs, but ensure that you are not giving in too much and spoiling him, that it gives him the idea that he is the boss of you.
Correct your dog when he is at his bad behavior. What is wrong is wrong, and there should no excuses and no exceptions. Reprimand fairly and then forgive. Do it quickly and with authority, and then do not hold any grudges. Be tough but also loving. Do not forget to also praise him and acknowledge his good behaviors.