OBJECTIVE: We aimed to investigate whether health-promoting text messages sent to patients with hypertension in primary care could affect lifestyle habits, and if the Theory of Planned Behavior could be used to identify moderators of intervention effects. METHODS: From September 2020 to December 2022, patients with hypertension were randomly selected from the patient register at 10 Swedish primary health care centers and randomized 1:1 to receive health-promoting text messages or treatment as usual ( RESULTS: The text message group had a statistically significant decrease in the proportion of participants with alcohol use above four standard drinks per week (OR 0.35, 95 % CI 0.15-0.81), and in the proportion of participants being physically inactive (OR 0.60, 95 % CI 0.37-0.98). The effect could not be explained or predicted by a pragmatic adaptation of the Theory of Planned Behavior. CONCLUSIONS: Health-promoting text messages could be offered to Swedish primary care patients with hypertension as part of the effort to improve their lifestyle habits.