How environmental factors combine with genetic risk at the molecular level to promote complex trait diseases such as multiple sclerosis (MS) is largely unknown. In mice, N-glycan branching by the Golgi enzymes Mgat1 and/or Mgat5 prevents T cell hyperactivity, cytotoxic T-lymphocyte antigen 4 (CTLA-4) endocytosis, spontaneous inflammatory demyelination and neurodegeneration, the latter pathologies characteristic of MS. Here we show that MS risk modulators converge to alter N-glycosylation and/or CTLA-4 surface retention conditional on metabolism and vitamin D3, including genetic variants in interleukin-7 receptor-α (IL7RA*C), interleukin-2 receptor-α (IL2RA*T), MGAT1 (IVAVT−T) and CTLA-4 (Thr17Ala). Downregulation of Mgat1 by IL7RA*C and IL2RA*T is opposed by MGAT1 (IVAVT−T) and vitamin D3, optimizing branching and mitigating MS risk when combined with enhanced CTLA-4 N-glycosylation by CTLA-4 Thr17. Our data suggest a molecular mechanism in MS whereby multiple environmental and genetic inputs lead to dysregulation of a final common pathway, namely N-glycosylation.