As rare earth (RE) metals are abundantly present in the soil, in spite of their name, it is conceivable that organisms may encounter and interact with RE ions. In the present study, we demonstrated that the soil nematode Caenorhabditis elegans avoids RE ions, such as yttrium and all examined lanthanide ions, which exhibit toxic effects on nematodes. We also demonstrated that the chemosensory system of this animal mediates avoidance behavior toward RE ions similar to heavy metal (HM) ion avoidance. The C. elegans
dyf-11(
pe554) mutant is unable to respond to chemosensory cues because it lacks all ciliated endings of the chemosensory neurons required for the detection of environmental chemicals. Cell-specific rescue of the
dyf-11 mutant and cell-specific genetic ablation studies revealed that the avoidance behavior toward HM and RE ions was mediated by a partially overlapping but distinct subset of chemosensory neurons (ASH, ADL, ASE, ADF, and ASK). With the help of multiple chemosensory neurons, worms may improve the fidelity of avoidance behavior to evade RE ions. Among the chemosensory neurons in C. elegans, ADF and ASK neurons were involved in RE avoidance, but not in HM avoidance. These results suggested that ADF and ASK neurons in C. elegans have RE-selective mechanisms to mediate the avoidance response.