Methamphetamine (meth) use is very common among men who have sex with men (MSM), particularly MSM living with HIV. Meth use among HIV-negative and HIV-positive MSM is up to 13 and 34 times more prevalent than in the general U.S. adult population, respectively. Meth use is independently associated with HIV-related sexual risk behaviors among MSM and can function as a barrier to antiretroviral therapy (ART) and pre-exposure prophylaxis (PrEP) adherence. Thus, effective interventions to reduce meth use may also function as an important HIV prevention and care intervention by reducing meth-related HIV risk behavior, and optimizing ART and PrEP adherence. MSM comprise two-thirds of the new infections in the United States. Despite this continued domestic HIV epidemic and the high prevalence of meth use among MSM, few interventions have proven efficacious for MSM who use meth. The investigators seek to address this gap by evaluating the efficacy of intermittent oral naltrexone enhanced with an ecological momentary intervention (ION+EMI) for meth use treatment. Naltrexone, a µ-opioid receptor antagonist, is a promising agent for MSM who use meth. Meth is rapidly metabolized to amphetamine in the bloodstream and daily naltrexone has shown efficacy in reducing amphetamine urine-positivity and relapse. Oral naltrexone is inexpensive and has few toxicities, but the standard daily regimen for naltrexone hampers compliance as patients frequently neglect to take the medication. Alternate regimen schedules have been proposed to increase efficacy and expand the population that may benefit from this pharmacologic agent. One alternative approach is the targeted administration of intermittent oral naltrexone (ION), whereby individuals are instructed to take the medication as needed in anticipation of substance use, after exposure to triggers of substance use, or during periods of craving. Administration of naltrexone prior to exposure to amphetamines significantly attenuated amphetamine craving in 4 trials. Additionally, emerging evidence suggests that ecological momentary interventions (EMI) that respond to in-the-moment contexts can lead to positive health behaviors, such as increasing medication dosing. EMI are particularly well-suited to enhancing as-needed dosing of naltrexone because anticipation of meth use and meth craving in a natural setting changes within a person from moment to moment, and the detection of these momentary fluctuations can support the delivery of just-in-time messages to encourage medication use to prevent participants from proceeding from craving to meth use. A pilot study led by our research team on ION found that meth-using MSM who use at least 1 day per week had significantly greater reductions in meth-using days when treated with as-needed naltrexone, compared to placebo. Moreover, naltrexone participants had greater reductions in serodiscordant receptive anal intercourse and serodiscordant condomless receptive anal intercourse, compared to placebo. In the pilot, participants reported taking study drug 64% of the days that they craved or anticipated meth use. Participants also completed ecological momentary assessments (EMA) with a 74% response rate, indicating that real-time assessments are feasible and acceptable. To build on the results of this study and 4 other naltrexone trials, the investigators propose to evaluate intermittent naltrexone to treat meth in a phase 2b efficacy trial supplemented by an EMA-informed EMI that responds to a participant's real-time craving levels or anticipated meth use to provide in-the-moment medication reminders when participants would most benefit from naltrexone. The investigators hypothesize that pairing ION with EMI will further amplify reductions in meth use by providing just-in-time reminders for naltrexone to optimize adherence, thereby interrupting the progression from craving to meth use.