Ah Lavender you are not a bad friend, everything you you wrote about what you have done and said has been very good. Honestly you have said the right things. There was something I read the other day that said "You cannot simultaneously set a boundary and tend to the other person's feelings." And this makes us uncomfortable, because we want them to be ok too, but a boundary is to do with you not them.
A quote that has always stuck with me is "the amount of abuse we put up with before we walk away, is exactly equal to the amount of abuse we give ourselves." I would guess ultimately your friends problems come from somewhere deep within herself. Its not even about this guy, he is a symptom.
But I am so so sorry to hear about what you are dealing with... Reaching the point where you have to protect yourself does not make you a bad friend. It makes a person dealing with too much.