Sirach 6:5-17 discusses the nature of true friendship.
Sirach 8:1-19 gives advice in dealing with others. One verse says, “Be not too familiar with an unruly man, lest he speak ill of your forebears.”
Lastly, Sirach 9:10-16 is good, esp vs 16, “Have just men for your table companions; in the fear of God be your glory.”
I think that should help. As far as a purely practical explanation goes: you become like your friends. Sure you could serve as a good influence for them, but they could also subvert you. Realistically, the latter will happen if you associate with them in base activities. To be a true friend, offer them the truth. You may certainly continue to associate with them, but be on your guard (as Sirach would warn you). This may be difficult depending on how they react, but it is extremely important. In the OT, not sure which book, it tells us that if we give a man the truth with regards to faith and they reject it, they are lost. On the other hand, if we do not give them the truth, we are lost just as they.
In short, have patience with your friends but do not lead them to believe that a base action is acceptable. Above all do not participate in these actions yourself. Good luck and I hope this helped.