I have two rules that I abide by in a jam session:

1) As one pro said to me in my early days after I nearly wrecked a jam session: Listen, listen, listen.  A lot of amateurs think it’s about how well you play.  It’s really about how well you listen.

2) Don’t play unless you know you can play something that will make the entire band sound better. If you don’t know how to make the band sound better, don’t play.  (It’s okay not to play.)  If you want to know how to make the band sound better: listen, listen, listen.

When you try to make yourself sound good above all else, you make enemies.  (I’ve seen it over and over.)  When you try to make the whole band sound better, you make friends, and you make yourself a welcome guest.