To go further on this topic. It's very important to have things going on outside of your friendship. Passions, hobbies, fulfillment.
Toxic behavior doesn't affect you like it does when you're very grounded and secure in who you are and what you value. You are able to more easily put into perspective your friendship and what it means to you. You often find yourself not having time to entertain negativity and gossip and just general bullshit. Some people will critisize you and lash out at you for being aloof, but I think that is a benefit in and of itself as it will naturally screen out a lot of bad seeds.
At the same time, I want to emphasize that negative feedback from friends is GOOD. I'm not here to preach 'don't give a fuck and do your own thing'. If one of your friends is roasting you, you have to decide whether it's because of their emotional state or if there's some truth to what they're saying.
Also, I think it's important when joining any relationship to understand their role model. It's the same with ANY relationship, you have to understand where they're coming from. Some people are coming from backgrounds where there's abuse, and some people are coming from backgrounds where all their ideas of relationships are formed by romantic comedies and being daddies little girl. It's a lot easier to understand and correct your friends toxic behavior when they act up because you know where they're coming from and how the ideal relationship looks in their mind.
Oh and how you go about "correcting" your friends behavior. You use brutal sarcasm. If they're acting like a cunt, act exactly how they're acting back to them in a way that is making light of the situation. Perfect example of this is I just made a new friend who came from a different school. Literally everything he does and says somehow relates to how shit our school is and how cool he was at his old school and how much better it was. He's almost completely stopped doing it after I literally repeat verbatim what he says back to me in a funky accent.