Background: Diabetes treatments are needed that are convenient, provide effective glycaemic control, and do not cause weight gain. We aimed to test the hypothesis that improvement in haemoglobin A1c (HbA1c) achieved with once weekly exenatide was superior to that achieved with insulin glargine titrated to glucose targets. Methods: In this 26-week, open-label, randomised, parallel study, we compared exenatide with insulin glargine in adults with type 2 diabetes who had suboptimum glycaemic control despite use of maximum tolerated doses of blood-glucose-lowering drugs for 3 months or longer. Patients were randomly assigned to add exenatide (2 mg, once-a-week injection) or insulin glargine (once-daily injection, starting dose 10 IU, target glucose range 4·0-5·5 mmol/L) to their blood-glucose-lowering regimens. Randomisation was with a one-to-one allocation and block size four, stratified according to country and concomitant treatment (70% metformin only; 30% metformin plus sulphonylurea). Participants and clinical investigators were not masked to assignment, but investigators analysing data were. The primary endpoint was change in HbA1c from baseline, and analysis of this outcome was by modified intention to treat for all patients who received at least one dose of study drug. This trial is registered at ClinicalTrials.gov, number NCT00641056. Findings: 456 patients were randomly allocated to treatment and were included in the modified intention-to-treat analysis (233 exenatide, 223 insulin glargine). Participants who received at least one dose of study drug and for whom baseline and at least one postbaseline measurement of HbA1c were available were included in the primary efficacy analysis. Change in HbA1c at 26 weeks was greater in patients taking exenatide (n=228; -1·5%, SE 0·05) than in those taking insulin glargine (n=220; -1·3%, 0·06; treatment difference -0·16%, 0·07, 95% CI -0·29 to -0·03). 12 (5%) of 233 patients allocated to exenatide and two (1%) of 223 taking insulin glargine discontinued participation because of adverse events (p=0·012). A planned extension period (up to 2·5 years' duration) is in progress. Interpretation: Once weekly exenatide is an important therapeutic option for patients for whom risk of hypoglycaemia, weight loss, and convenience are particular concerns. Funding: Amylin Pharmaceuticals; Eli Lilly and Company.