To compare the consumption of antibiotics (AB), systemic steroids, and inhaled bronchodilators/glucocorticoids in the 3 years preceding the diagnosis of common variable immunodeficiency (CVID) among CVID patients and matched controls and to estimate whether the level of consumption was associated with the risk of a subsequent CVID diagnosis. We conducted a nested case-control study, identifying all individuals (n=130 cases) diagnosed with CVID in Denmark (1994-2014) and 45 age- and sex-matched population controls per case (n=5850 controls) from national registers. Drug consumption was estimated as defined daily doses per person-year. We used conditional logistic regression to compute odds ratios and 95% confidence intervals. In the 3 years preceding a CVID diagnosis, we observed more frequent and higher consumption of all three drug classes. The association between consumption and risk of subsequent CVID diagnosis was statistically significant for all drug classes. The association was stronger with higher consumption and shorter time to CVID diagnosis. The fraction of cases compared to the controls redeeming ≥1 prescription of the included drugs during the study period was higher for AB (97% vs 52%), systemic steroids (35% vs 7.4%), and inhaled bronchodilators/glucocorticoids (46% vs 11.7%) (p<0.001). CVID patients have significantly higher use of AB, systemic steroids, and inhaled bronchodilators/glucocorticoids in the 3 years preceding CVID diagnosis than controls. Prescribing these drugs in primary healthcare could be an opportunity to consider (proactive) screening for CVID. Further studies are needed to identify optimal prescription cutoffs that could endorse its inclusion in public health policies.