Retreat selection can be a complex process to understand due to the effects of multiple biotic and abiotic factors. The control of these variables through experimental studies may help to explain the factors that affect microhabitat selection. We experimentally examined whether retreat-site selection by two fossorial Mexican earthsnakes (Conopsis biserialis and C. nasus) is determined by the effects of temperature inside the retreat and/ or the presence of chemical prey cues in the laboratory. We also examined whether visual prey cues or their combination with chemical prey cues have a significant effect on retreat-site selection. Overall our results show that retreat-site selection of both earthsnake species was mainly based on foraging opportunities, as indicated by the selection of retreats with presence of prey chemical cues, even when thermal conditions were not favorable. In the absence of prey cues, however, earthsnakes preferred warmer retreats. Earthsnakes showed strong selection for chemical prey cues, and no selection for visual prey cues. The addition of visual prey cues to chemical prey cues did not affect retreat selection. Therefore, resource selection by earthsnakes appeared to be strongly guided by the presence of chemical prey cues, and to a lesser extent, thermal conditions. We observed similar habitat selection in the two earthsnakes species, likely due to their close phylogenetic relationship. Although several other factors might affect habitat selection by fossorial earthsnakes, it may be explained, at least partially, by the influence of physiological needs such as foraging and thermoregulation.José Martín was supported by the Spanish Ministerio de Ciencia, Innovación y Universidades grant MICINN PGC2018-093592-B-I00