Background: Obesity has been linked to increased mortality in several cancer types; however, the relation between obesity and survival outcomes in metastatic melanoma is unknown. The aim of this study was to examine the association between body-mass index (BMI) and progression-free survival or overall survival in patients with metastatic melanoma who received targeted therapy, immunotherapy, or chemotherapy. Methods: This retrospective study analysed independent cohorts of patients with metastatic melanoma assigned to treatment with targeted therapy, immunotherapy, or chemotherapy in randomised clinical trials and one retrospective study of patients treated with immunotherapy. Patients were classified according to BMI, following the WHO definitions, as underweight, normal, overweight, or obese. Patients without BMI and underweight patients were excluded. The primary outcomes were the associations between BMI and progression-free survival or overall survival, stratified by treatment type and sex. We did multivariable analyses in the independent cohorts, and combined adjusted hazard ratios in a mixed-effects meta-analysis to provide a precise estimate of the association between BMI and survival outcomes; heterogeneity was assessed with meta-regression analyses. Analyses were done on the predefined intention-to-treat population in the randomised controlled trials and on all patients included in the retrospective study. Findings: The six cohorts consisted of a total of 2046 patients with metastatic melanoma treated with targeted therapy, immunotherapy, or chemotherapy between Aug 8, 2006, and Jan 15, 2016. 1918 patients were included in the analysis. Two cohorts containing patients from randomised controlled trials treated with targeted therapy (dabrafenib plus trametinib [n=599] and vemurafenib plus cobimetinib [n=240]), two cohorts containing patients treated with immunotherapy (one randomised controlled trial of ipilimumab plus dacarbazine [n=207] and a retrospective cohort treated with pembrolizumab, nivolumab, or atezolizumab [n=331]), and two cohorts containing patients treated with chemotherapy (two randomised controlled trials of dacarbazine [n=320 and n=221]) were classified according to BMI as normal (694 [36%] patients), overweight (711 [37%]), or obese (513 [27%]). In the pooled analysis, obesity, compared with normal BMI, was associated with improved survival in patients with metastatic melanoma (average adjusted hazard ratio [HR] 0·77 [95% CI 0·66–0·90] for progression-free survival and 0·74 [0·58–0·95] for overall survival). The survival benefit associated with obesity was restricted to patients treated with targeted therapy (HR 0·72 [0·57–0·91] for progression-free survival and 0·60 [0·45–0·79] for overall survival) and immunotherapy (HR 0·75 [0·56–1·00] and 0·64 [0·47–0·86]). No associations were observed with chemotherapy (HR 0·87 [0·65–1·17, pinteraction=0·61] for progression-free survival and 1·03 [0·80–1·34, pinteraction=0·01] for overall survival). The association of BMI with overall survival for patients treated with targeted and immune therapies differed by sex, with inverse associations in men (HR 0·53 [0·40–0·70]), but no associations observed in women (HR 0·85 [0·61–1·18, pinteraction=0·03]). Interpretation: Our results suggest that in patients with metastatic melanoma, obesity is associated with improved progression-free survival and overall survival compared with those outcomes in patients with normal BMI, and that this association is mainly seen in male patients treated with targeted or immune therapy. These results have implications for the design of future clinical trials for patients with metastatic melanoma and the magnitude of the benefit found supports further investigation of the underlying mechanism of these associations. Funding: ASCO/CCF Young Investigator Award, ASCO/CCF Career Development Award, MD Anderson Cancer Center (MDACC) Melanoma Moonshot Program, MDACC Melanoma SPORE, and the Dr Miriam and Sheldon G Adelson Medical Research Foundation.