In the current context of resource scarcity and increased pollution, enterprises need to better allocate capacity and achieve carbon emission reduction. We examine the optimal decision problem for a closed-loop supply chain (CLSC) considering capacity constraints and stochastic demand under a cap-and-trade system. A two-level CLSC comprising a supplier and a manufacturer is established. To make the model more realistic, we treat demand as a random variable, consider the manufacturer’s production capacity within a certain upper limit, and allow the manufacturer to make investments to expand capacity to complete production demand. Based on this CLSC, the collection activities of the supplier and manufacturer are considered. Meanwhile, government carbon limits and carbon trading controls on the manufacturer are considered based on carbon reduction by enterprises. Through modeling and analysis, optimal decisions are derived for the amount of capacity investment, level of carbon emission reduction, and collection price variables. The results indicate that supplier collection has a positive effect on the sustainability of the CLSC. Moreover, the government’s carbon quota and carbon trading control of manufacturers can effectively reduce the carbon emissions of the CLSC, encourage enterprises to reduce carbon emissions, and improve the sustainability of the CLSC.