Mammals possess a remarkable ability to sense subtle temperature deviations from the thermoneutral skin temperature of ~33 °C, which ensures precise warm sensation. However, the underlying mechanisms remain unclear. Here we show that STIM1, an endoplasmic reticulum (ER) resident transmembrane protein that responds to both ER Ca2+ depletion and heat, mediates temperature-induced Ca2+ influx in skin keratinocytes via coupling to Orai Ca2+ channels in plasma membrane. Behaviorally, the keratinocyte-specific knockout of STIM1 shifts the optimal preference temperature (OPT) of mice from ~32 °C to ~34 °C, resulting in a strikingly reversed preference between 32 °C and 34 °C. Importantly, the thermally inactive STIM1-ΔK knock-in mice show altered OPT and warm preference behaviors as well, demonstrating the requirement of STIM1 thermosensitivity for warm sensation. Furthermore, the wild-type and mutant mice prefer temperatures closer to their respective OPTs, but poorly distinguish temperatures that are equally but oppositely deviated from their OPTs. Mechanistically, keratinocyte STIM1 affects the in vivo warm responses of sensory neurons by likely involving TRPA1 as a downstream transduction channel. Collectively, our data suggest that STIM1 serves as a novel in vivo thermosensor in keratinocytes to define the OPT, which might be utilized as a peripheral reference temperature for precise warm sensation.