Many times, it is people’s lack of confidence in their own self that makes them behave like this. As you said, he likes to be the nice and funny guy and pretends to be something else in front of people when he’s actually not that.
He should be doing so out of his insecurities and inferiority complex. In this process, he constantly tries to intimidate you on a personal level and more in front of others. Because of their own securities, such people naturally boast about themselves by proving someone else inferior; the one whom they consider weaker than them.
In your case, it’s pretty evident that somewhere your husband considers you weaker in much sense and hence intimidating you give him a sense of superiority and false achievement for himself. He might be doing it intentionally or intentionally but his own self-complex does play an important role in this.
The best way to deal with such a situation is to prove him that his misconception of you being a weaker half is false; that it really doesn’t matter to you what he feels and thinks about you.
Approach him. In a calm and polite manner, have a talk with him. Tell him what you feel right and wrong; that what he’s doing is only affecting him and no one else. In no way, it is making any difference to you. Let him know that you really don’t care what he thinks about you and that you are much stronger than what he thinks of you. Tell him that it’s his image that is getting spoilt in front of outsiders; that how he treats and makes a mockery of his wife and doesn’t respect her.
Having said all this to him, the ball is now in your court. What you said needs to reflect in your actions. Do not pay heed to whatever he talks about you in front of his friends. Show him that you really don’t care about whatever wrong he speaks about you. The more you pay heed, the more will he be encouraged to do so. The moment you stop giving him importance, he’ll realise that his efforts are in vain and he needs to give a thought to his actions. You might have to be a bit stubborn too at times, but along with that show you concern for him wherever possible.
This will make him feel guilty of his actions. He’ll realise that you can love and even stand for what is wrong. Where and how you should respond would depend a lot upon the time and the situation. When he starts to realise his mistake, help him gain his self-confidence back. That is the second step.
All this needs time friend. Perseverance and patience is the key. Remember this. Stay strong and don’t give up. Things can work out only if we wish to make them work and that too with a true will, love and compassion.
Your husband needs you. Help him. Do write back on his progress or any inputs if you feel so.
All the best!