Your issue is one that many struggle with (present company included). However, it can be hard to pinpoint and provide a singular solution. The best I could do is provide you with what worked for me.
In my case, becoming more immune to pressure situations required forcing myself to think I couldn't care less about the stakes while building myself up with inner-positive affirmation. I think sometimes we can be victims of our own thoughts. We know too much. In the case of basketball, it helps to simplify matters, while maybe lying to yourself a little; or at least, one may need a change of perspective.
For instance, early in high school I'd play amongst players 2-3 years my senior. Prior to ballgames, in warmups and before tip-off, I had a lot of uncertainty regarding my opponents. I made it about them. I'd wonder how good a certain player was going to be against me and I'd almost always assume the worst (meaning, I'd think they might light me up for 30). My approach was somewhat defensive. As in, my plan was just to survive against these opponents I played, whether they were truly better than me or not.
The mental approach I was required to change for the betterment of my abilities was to enter games, practices, and clutch situations with uber-confidence. A lot of times, extreme confidence may have not been there by default, but telling myself enough positive things seemed to turn the tide. I had to get it to a point where prior to a game, my thoughts were, "Man, I feel bad for these guys, because I don't think they're ready for me." I had to convince myself that's the way things truly were. In turn, I was able to more confidently perform up to my normal standards.
You know what else helps? Perspective. On the surface, when someone I wanted to impress showed up (coach, dad, girlfriend) I used to think (and still sometimes do), "Do something impressive. C'mon. Don't screw up." The truth though, is that none of what you do on the basketball court is particularly important. Even if I were to go 0-13 from the field, anyone who matters to me in life would probably forget about it by the next day. It's just not that serious. Remember why you play in the first place.
Also, as a final note, don't worry about the coach seeing you struggle against a better player here and there. Coaches usually are actually pretty good at judging the entire picture, if that makes sense. I can't remember the last time I judged a player's skill strictly off of a 3 on 3 game I happened to walk in on. Often, I can see a player struggle over a period of time and can still tell he'll be a legitimate ball player for me. Sometimes shots just don't fall. Sometimes things just don't come together. Coaches can see that. They can also see potential and hope, so playing in front of a coach is not worth getting all crazy about.