How to leave a collaborator after being offered to join a new group?
First make sure that this is what you want. This is a very important thing to do. Being in a better team is a chance, but also a burden. They will expect you to cooperate at a certain level, which means: stress, lots of work and being on time. If you think that's worth the result and that you are willing to dive into that, then do it.

If your friend is a good friend he/she will understand. I'd suggest to invite your friend for an activity that both of you enjoy a lot, then bring up the topic. Make it clear to your friend that you value the relationship and how difficult it is for you to take that decision, but also can't put down the chance. Ask him/her what he/she would do in your position to get your friend to see it with your eyes.

True friendship will survive that. And if not, then knowing that you took the right decision will help you getting over it.