C. elegans exhibits a directional migration toward a remembered temperature setpoint (Ts) by activating thermo-sensorimotor neurons. While cryophilic thermotaxis is well reproduced, thermophilic thermotaxis requires very stringent temperature regulations – otherwise, worms exhibit random migration in colder side of Ts. Here, we introduce a thermal stimulus device developed to control worms with different thermotactic behaviors on both colder and warmer sides of the Ts. On a linear gradient, the worm population displayed a Gaussian distribution near Ts but in a skewed shape with a peak shifted to the colder side due to their atactic motion in colder temperature than Ts. By repetitive application of thermal gradient-reversals, we found that their population density became higher near Ts because the speed at which the worms accumulate toward Ts was much faster than that of the dispersion by diffusion to the cold side, resulting in forced aggregation of worms at the desired temperature.