Two-pore domain potassium channels (K2P) are a large family of “background” channels that allow outward “leak” of potassium ions. The NALCN/UNC80/UNC79 complex is a non-selective channel that allows inward flow of sodium and other cations. It is unclear how K2Ps and NALCN differentially modulate animal behavior. Here, we found that loss of function (lf) in the K2P gene twk-40 suppressed the reduced body curvatures of C. elegans NALCN(lf) mutants. twk-40(lf) caused a deep body curvature and extended backward locomotion, and these phenotypes appeared to be associated with neuron-specific expression of twk-40 and distinct twk-40 transcript isoforms. To survey the functions of other less studied K2P channels, we examined loss-of-function mutants of 13 additional twk genes expressed in the motor circuit and detected defective body curvature and/or locomotion in mutants of twk-2, twk-17, twk-30, twk-48, unc-58, and the previously reported twk-7. We generated presumptive gain-of-function (gf) mutations in twk-40, twk-2, twk-7, and unc-58 and found that they caused paralysis. Further analyses detected variable genetic interactions between twk-40 and other twk genes, an interdependence between twk-40 and twk-2, and opposite behavioral effects between NALCN and twk-2, twk-7, or unc-58. Finally, we found that the hydrophobicity/hydrophilicity property of TWK-40 residue 159 could affect the channel activity. Together, our study identified twk-40 as a novel modulator of the motor behavior, uncovered potential behavioral effects of five other K2P genes and suggests that NALCN and some K2Ps can oppositely affect C. elegans behavior.