We developed a quantitative assay for Caenorhabditis elegans avoidance behavior. This was then used to demonstrate that the worm moved away from toxic concentrations of Cd2+ and Cu2+, but not Ni2+, all ions that prevented development from larval to adult stages. Mutants that have structural defects in ciliated neurons (che-2 and osm-3) as well as worms with three laser-operated neurons (ADL, ASE, and ASH), showed no avoidance behavior from Cd2+ and Cu2+. These results suggest that the avoidance from Cd2+ and Cu2+ are mediated through multiple neural pathways including ADL, ASE, and ASH neurons. We hypothesize that the three sensing neurons provide increased accuracy of the sensory response and a survival advantage in the natural environment of the worm.