Practice Metta. SN20.3 states that if one practices Metta, non-human beings cannot do him/her any wrong. So the advice from this sutta is to practice Metta, and of course to have perfect morality.
In other cases, the same sutta states that one cannot get rid of such non-human beings.
Where knowledge ends, religion begins. - B. Disraelihttp://www.buddha-vacana.org
As a sweet-smelling and beautiful lotus flower may grow upon a heap of rubbish thrown on the highway, so also, out of the rubbish heap of beings may appear a disciple of the Buddha, who with his wisdom, shines resplendent in wisdom. -/ Dhp 58-59