With the increasing integration of distributed generation (DG) into distribution networks, the impact of its output and configuration on the environment and overall benefits has become more pronounced. To enhance environmental benefits while minimizing costs, an optimization model for DG location and capacity considering environmental benefits (LCEB) is proposed. Initially, a mathematical model for DG location and capacity is established, with optimization objectives including voltage deviation, network loss, and environmental benefit. Subsequently, modified particle swarm optimization (MPSO) with a single-dimension search probability mutation is employed to solve this model, obtaining an optimized DG output and layout scheme. Finally, the feasibility and effectiveness of the proposed model are demonstrated through simulation and analysis by using the IEEE33 node system as an example. The results highlight the model’s capability to improve environmental and economic benefits, enhance voltage levels, and reduce network losses within the distribution network.