I've been in this situation with both family and friends. I must say that it's been much easier to deal with it with friends than with family. With stubborn friends that keep insisting I convert to their religion, I just put my foot down and that usually does it. I say to them: "look, if you want us to stay friends, you need to respect my beliefs as I respect yours. If we can't have a conversation about religion without you trying to convert me or disrespecting me or my beliefs, then it's best we don't talk about religion at all and if you can't deal with that, then it's best we end this friendship now". Works great for me and haven't had a friendship end yet. If your friend truly loves you, he/she will learn to accept and respect your beliefs and will stop trying to convert you.