Objective: This trial aimed to evaluate the glycemic control of polyethylene glycol loxenatide measured with continuous glucose monitoring (CGM) in patients with type 2 diabetes mellitus (T2DM), with the hypothesis that participants given PEG-Loxe would spend more time in time-in-range (TIR) than participants were given insulin glargine after 24 weeks of treatment.Methods: This 24-week, randomized, open-label, parallel-group study was conducted in the Department of Endocrine and Metabolic Diseases, Longhu Hospital, Shantou, China. Participants with T2DM, who were ≥45 years of age, HbA1c of 7.0%–11.0%, and treated at least 3 months with metformin were randomized (1:1) to receive PEG-Loxe or insulin glargine. The primary endpoint was TIR (blood glucose range: 3.9–10.0 mmol/L) during the last 2 weeks of treatment (weeks 22–24).Results: From March 2020 to April 2022, a total of 107 participants with T2DM were screened, of whom 78 were enrolled into the trial (n = 39 per group). At the end of treatment (weeks 22–24), participants given PEG-Loxe had a greater proportion of time in TIR compared with participants given insulin glargine [estimated treatment difference (ETD) of 13.4% (95% CI, 6.8 to 20.0, p < 0.001)]. The tight TIR (3.9–7.8 mmol/L) was greater with PEG-Loxe versus insulin glargine, with an ETD of 15.6% (95% CI, 8.9 to 22.4, p < 0.001). The time above range (TAR) was significantly lower with PEG-Loxe versus insulin glargine [ETD for level 1: −10.5% (95% CI: −14.9 to −6.0), p < 0.001; ETD for level 2: −4.7% (95% CI: −7.9 to −1.5), p = 0.004]. The time below range (TBR) was similar between the two groups. The mean glucose was lower with PEG-Loxe versus insulin glargine, with an ETD of −1.2 mmol/L (95% CI, −1.9 to −0.5, p = 0.001). The SD of CGM glucose levels was 1.88 mmol/L for PEG-Loxe and 2.22 mmol/L for insulin glargine [ETD -0.34 mmol/L (95% CI: −0.55 to −0.12), p = 0.002], with a similar CV between the two groups.Conclusion: The addition of once-weekly GLP-1RA PEG-Loxe to metformin was superior to insulin glargine in improving glycemic control and glycemic variability evaluated by CGM in middle-aged and elderly patients with T2DM.