As an environment-dependent pleiotropic gene regulator in Gram-negative bacteria, the H-NS protein is crucial for adaptation and toxicity control of human pathogens such as Salmonella, Vibrio cholerae or enterohaemorrhagic Escherichia coli. Changes in temperature affect the capacity of H-NS to form multimers that condense DNA and restrict gene expression. However, the molecular mechanism through which H-NS senses temperature and other physiochemical parameters remains unclear and controversial. Combining structural, biophysical and computational analyses, we show that human body temperature promotes unfolding of the central dimerization domain, breaking up H-NS multimers. This unfolding event enables an autoinhibitory compact H-NS conformation that blocks DNA binding. Our integrative approach provides the molecular basis for H-NS-mediated environment-sensing and may open new avenues for the control of pathogenic multi-drug resistant bacteria.