Developing high-performance wide bandgap polymer donors to match the rapidly growing non-fullerene small molecule acceptors (NF-SMAs) is of great importance to further improve the photovoltaic performances of organic solar cells (OSCs). PM6 and D18 are two leading wide bandgap donor polymers, but their performances are highly sensitive to the molecular weights, which have distinct impact on the morphology and thereby the charge generation and recombination processes. In this work, we reported the random ternary copolymerization of PM6 and D18 segments to develop random terpolymers with finely tuned photoelectronic properties and optimized blend morphology for high-performance OSCs. The resulting random terpolymers (PMD-5, PMD-10, PMD-15 and PMD-20) exhibited finely tuned absorptions, energy levels and blend morphology. The optimal morphology of PMD-15:L8-BO contributed to the fast exciton diffusion and dissociation, efficient charge extraction with suppressed recombination. Thus, the power conversion efficiency was improved from 17.22% of the control PM6 devices and 17.47% of the control D18 devices to 18.12% of PMD-15 based devices, which is the top performance of random terpolymers. Moreover, the PMD-15 exhibited much higher batch-to-batch reproducibility at a broad molecular weight range than that of PM6 and D18, showing promising for practical applications.