He might put you down in front of his friends because he has negative feelings about himself, which is the most common reason why people put other people down. Men who put their partners down in front of their friends usually want to make it known that they are the leaders in the relationship and that they are in control of their partner, because is somehow tied to their self-esteem and their need to be seen as competent by their friends. Another reason he might put you down in front of his friends may be to take away their attention from him because subconsciously he knows that if people are looking to you they will obviously not be criticizing him for anything.