Hydrogen sulfide (H2S) acts as an energy source, a toxin, and a gasotransmitter across diverse biological contexts. We use the robust locomotory responses of Caenorhabditis elegans to high levels of H2S to elucidate the molecular mechanisms underlying its acute perception and adaptive responses. We find that the H2S-evoked behavioral response is shaped by multiple environmental factors including oxygen (O2) levels and nutritional state, and is modulated by various pathways such as insulin, TGF-{beta}, and HIF-1 signaling, as well as by input from O2-sensing neurons. Prolonged exposure to H2S activates HIF-1 signaling, leading to the upregulation of stress-responsive genes, including those involved in H2S detoxification. This promotes an adaptive state in which locomotory speed is reduced in H2S, while responsiveness to other stimuli is preserved. In mutants deficient in HIF-1 signaling, iron storage, and detoxification mechanisms, animals display a robust initial response but rapidly enter a sleep-like behavior characterized by reduced mobility and diminished responsiveness to subsequent sensory stimuli. Furthermore, while acute production of mitochondria-derived reactive O2 species (ROS) appears to initiate the avoidance response to H2S, persistently high ROS promotes an adaptive state, likely by activating various stress-response pathways, without substantially compromising cellular H2S detoxification capacity. Taken together, our study provides comprehensive molecular insights into the mechanisms through which C. elegans detects, modulates, and adapts its response to H2S exposure.