Praise be to Allah.
If the relationship between you and them is as you describe, then adhere to the Book of Allah and the guidance of His Messenger (peace and blessings of Allah be upon him). Try to advise them, enjoin upon them that which is right and good, and forbid them to do that which is evil. Be patient in bearing their insults and harm, and do not let their insults deter you from carrying out your duty towards them, which is to enjoin what is good and forbid what is evil. This is the way of Allah concerning the callers and those who are called. Allah has explained that in the aayah where He tells us that Luqmaan said to his son (interpretation of the meaning):
“O my son! Aqim-is-Salaat (perform As-Salaah), enjoin (on people) Al-Ma‘roof(Islamic Monotheism and all that is good), and forbid (people) from Al-Munkar (i.e. disbelief in the Oneness of Allah, polytheism of all kinds and all that is evil and bad), and bear with patience whatever befalls you. Verily, these are some of the important commandments (ordered by Allah with no exemption)” [Luqmaan 31:17]
If you fulfil your obligation of advising them, and you do this repeatedly but do not find any way to reach their hearts, or they cling more stubbornly to their falsehood, then withdraw from them lest you become weak in your religious commitment and moral standards, or their influence over you leads to bad consequences. Be sincere towards Allah and Allah will help you. Do not worry about feeling lonely if you leave them, for loneliness is better than bad companions.
“And whosoever fears Allah and keeps his duty to Him, He will make a way for him to get out (from every difficulty).
And He will provide him from (sources) he never could imagine. And whosoever puts his trust in Allah, then He will suffice him. Verily, Allah will accomplish his purpose. Indeed Allah has set a measure for all things” [al-Talaaq 65:2-3 – interpretation of the meaning]