The aim of this study was to evaluate the risk of discontinuing treatment with direct oral anticoagulants (DOACs) among patients with atrial fibrillation (AF) according to cohabitation status and gender. Using the Danish national registers, we identified 32 364 patients with AF aged 40-90 years undergoing treatment with DOACs. The study period was from 2013 to 2017, and patients were followed for 2 years, or until death, outcome, or emigration. The main outcome was discontinuation of DOAC treatment for at least 30 days. The absolute 2-year risk of DOAC discontinuation was highest among men living alone [35.7%, 95% confidence interval (CI): 37.3-34.1%]. Men living alone had a 4.6% (95% CI: 6.4-2.8%) higher absolute risk of discontinuation and a 12% [hazard ratio (HR): 1.12, 95% CI: 1.04-1.20] higher relative risk of discontinuation compared with men living with a partner. Female patients living alone likewise had a higher absolute risk of DOAC discontinuation (2.6%, 95% CI: 4.4-0.09%) compared with female patients living with a partner, yet no statistically significant difference in relative risk. In an analysis evaluating gender, we found male gender to be associated with a significantly higher relative risk of DOAC discontinuation (HR: 1.33, 95% CI: 1.26-1.40) compared with female gender (P-value for interaction with cohabitant status = 0.5996). In this nationwide population study, male gender and living alone were associated with a higher risk of DOAC discontinuation among patients with AF. © The Author(s) 2021. Published by Oxford University Press on behalf of the European Society of Cardiology.