ImportanceAlthough digital cognitive behavioral therapy for insomnia (dCBT-I) has been studied in many randomized clinical trials and is recommended as a first-line treatment option, few studies have systematically examined its effectiveness, engagement, durability, and adaptability in clinical settings.ObjectiveTo evaluate the clinical effectiveness, engagement, durability, and adaptability of dCBT-I.Design, Setting, and ParticipantsThis retrospective cohort study was conducted using longitudinal data collected via a mobile app named Good Sleep 365 between November 14, 2018, and February 28, 2022. Three therapeutic modes (ie, dCBT-I, medication, and their combination) were compared at month 1, month 3, and month 6 (primary). Inverse probability of treatment weighting (IPTW) using propensity scores was applied to enable homogeneous comparisons between the 3 groups.ExposuresTreatment with dCBT-I, medication therapy, or combination therapy according to prescriptions.Main Outcomes and MeasuresThe Pittsburgh Sleep Quality Index (PSQI) score and its essential subitems were used as the primary outcomes. Effectiveness on comorbid somnolence, anxiety, depression, and somatic symptoms were used as secondary outcomes. Cohen d effect size, P value, and standardized mean difference (SMD) were used to measure differences in treatment outcomes. Changes in outcomes and response rates (≥3 points change in PSQI score) were also reported.ResultsA total of 4052 patients (mean [SD] age, 44.29 [12.01] years; 3028 [74.7%] female participants) were selected for dCBT-I (n = 418), medication (n = 862), and their combination (n = 2772). Compared with the change in PSQI score at 6 months for participants receiving medication alone (from a mean [SD] of 12.85 [3.49] to 8.92 [4.03]), both dCBT-I (from a mean [SD] of 13.51 [3.03] to 7.15 [3.25]; Cohen d, −0.50; 95% CI, −0.62 to −0.38; P < .001; SMD = 0.484) and combination therapy (from a mean [SD] of 12.92 [3.49] to 6.98 [3.43]; Cohen d, 0.50; 95% CI, 0.42 to 0.58; P < .001; SMD = 0.518) were associated with significant reductions; dCBT-I had a comparable effect as combination therapy (Cohen d, 0.05; 95% CI, −0.05 to 0.15; P = .66; SMD = 0.05), but showed unstable durability. Outcomes of dCBT-I improved steadily and rapidly during the first 3 months, and then fluctuated. The response rates with dCBT-I and combination therapy were higher than with medication. Changes in secondary outcomes indicated statistically significant benefits from dCBT-I and combination therapy. The results of subgroup analysis were consistent with the main findings, demonstrating the superiority of dCBT-I vs medication therapy in various subpopulations.Conclusions and RelevanceIn this study, clinical evidence suggested that combination therapy was optimal, and dCBT-I was more effective than medication therapy, with long-term benefits for insomnia. Future studies are needed to analyze its clinical effectiveness and reliability in distinct subpopulations.