Mining disturbances can rupture the closed pores, releasing the gas and potentially triggering gas accidents. The pre-drainage of gas via boreholes is the primary measure for preventing coal and gas outbursts. Nevertheless, the influence of closed pores on gas migration remains unclear, leading to suboptimal borehole spacing and radius. Therefore, a gas–solid coupled model incorporating closed pores was developed to investigate the influence of closed pores on gas migration during gas drainage (GD). Subsequently, response surface methodology was employed to investigate the input parameters and their interactions on residual gas content (RGC) and pre-drainage time (PDT). Finally, an optimization methodology for borehole spacing/radius was presented. The results show that both RGC and PDT exhibit a positive correlation with the ratio of closed porosity to total porosity (λ) and the ratio of closed pore diffusion coefficient to that of the open pore (Do/Dc). Initially, the total gas production is primarily extracted from fractures and open pores, followed by closed pores in the later stages. Single-factor analysis demonstrates that λ, permeability, and Do/Dc have a more significant impact on RGC and PDT compared to borehole spacing and borehole radius. Borehole spacing interacts more strongly with λ, permeability and Do/Dc than borehole radius. An optimization method for borehole spacing and borehole radius, constrained by PDT, RGC, and the number of boreholes, is proposed using response surface optimization maps. This method provides guidance for borehole construction to optimize GD efficiency and minimize RGC.