The mechanisms underlying the transition from acute to chronic pain are unclear but may involve the persistence or strengthening of pain memories acquired in part through associative learning. Contextual cues, which comprise the environment in which events occur, were recently described as a critical regulator of pain memory; both male rodents and humans exhibit increased pain sensitivity in environments recently associated with a single painful experience. It is unknown, however, how repeated exposure to an acute painful unconditioned stimulus in a distinct context modifies pain sensitivity or the expectation of pain in that environment. To answer this question, we conditioned mice to associate distinct contexts with either repeated administration of a mild visceral pain stimulus (intraperitoneal injection of acetic acid) or vehicle injection over the course of 3 days. On the final day of experiments, animals received either an acid injection or vehicle injection prior to being placed into both contexts. In this way, contextual control of pain sensitivity and pain expectation could be tested respectively. When re-exposed to the noxious stimulus in a familiar environment, both male and female mice exhibited context-dependent conditioned analgesia, a phenomenon mediated by endogenous opioid signaling. However, when expecting the presentation of a painful stimulus in a given context, males exhibited conditioned hypersensitivity whereas females exhibited endogenous opioid-mediated conditioned analgesia. These results are evidence that pain perception and engagement of endogenous opioid systems can be modified through their psychological association with environmental cues. Successful determination of the brain circuits involved in this sexually dimorphic anticipatory response may allow for the manipulation of pain memories, which may contribute to the development of chronic pain states.