Background Patients with advanced cancer frequently experience anorexia and cachexia, which are associated with reduced food intake, altered body composition, and decreased functionality. We assessed anamorelin, a novel ghrelin-receptor agonist, on cachexia in patients with advanced non-small-cell lung cancer and cachexia. Methods ROMANA 1 and ROMANA 2 were randomised, double-blind, placebo-controlled phase 3 trials done at 93 sites in 19 countries. Patients with inoperable stage III or IV non-small-cell lung cancer and cachexia (defined as ≥5% weight loss within 6 months or body-mass index <20 kg/m2) were randomly assigned 2:1 to anamorelin 100 mg orally once daily or placebo, with a computer-generated randomisation algorithm stratified by geographical region, cancer treatment status, and weight loss over the previous 6 months. Co-primary efficacy endpoints were the median change in lean body mass and handgrip strength over 12 weeks and were measured in all study participants (intention-to-treat population). Both trials are now completed and are registered with ClinicalTrials.gov, numbers NCT01387269 and NCT01387282. Findings From July 8, 2011, to Jan 28, 2014, 484 patients were enrolled in ROMANA 1 (323 to anamorelin, 161 to placebo), and from July 14, 2011, to Oct 31, 2013, 495 patients were enrolled in ROMANA 2 (330 to anamorelin, 165 to placebo). Over 12 weeks, lean body mass increased in patients assigned to anamorelin compared with those assigned to placebo in ROMANA 1 (median increase 0·99 kg [95% CI 0·61 to 1·36] vs −0·47 kg [–1·00 to 0·21], p<0·0001) and ROMANA 2 (0·65 kg [0·38 to 0·91] vs −0·98 kg [–1·49 to −0·41], p<0·0001). We noted no difference in handgrip strength in ROMANA 1 (−1·10 kg [–1·69 to −0·40] vs −1·58 kg [–2·99 to −1·14], p=0·15) or ROMANA 2 (−1·49 kg [–2·06 to −0·58] vs −0·95 kg [–1·56 to 0·04], p=0·65). There were no differences in grade 3–4 treatment-related adverse events between study groups; the most common grade 3–4 adverse event was hyperglycaemia, occurring in one (<1%) of 320 patients given anamorelin in ROMANA 1 and in four (1%) of 330 patients given anamorelin in ROMANA 2. Interpretation Anamorelin significantly increased lean body mass, but not handgrip, strength in patients with advanced non-small-cell lung cancer. Considering the unmet medical need for safe and effective treatments for cachexia, anamorelin might be a treatment option for patients with cancer anorexia and cachexia. Funding Helsinn Therapeutics.