The coal measure reservoirs exhibit uneven fracture propagation due to multiple interfaces, strong heterogeneity, as well as interlayer stress differences. To promote uniform fracture growth, staged temporary plugging and diverting fracturing technology (TPDF) is essential. However, the stress interference between clusssters, the complex fracture propagation mechanisms, and the effects of temporary plugging parameters during TPDF are still not fully understood. This study employs a three-dimensional (3D) fluid–solid coupled finite element method, incorporsating the Park-Paulino-Roesler (PPR) cohesive model to develop a friction-cohesion element that couples pore pressure for simulating the mechanical response of complex fractures. Additionally, a random assignment program for mechanical parameters of layered reservoirs and a dynamic temporary plugging subroutine for perforation clusters were created, enabling dynamic flow distribution during TPDF in heterogeneous layered reservoirs. Results indicate that hydraulic fractures (HFs) generate tensile stress at their tips upon interacting with interfaces, promoting their penetration across the interface. As these fractures expand along the interface, the induced stress reduces the vertical stress on the interface, facilitating further interface expansion and leading to the formation of a type I-II hybrid fracture. While this mechanism may create complex fracture networks, stress interference and interface constraints can hinder intermediate fractures from penetrating interfaces. Thus, plugging high-flow perforation clusters and increasing fluid pressure in low-flow clusters are necessary to promote uniform multiple fractures expansion. Furthermore, plugging parameters have been quantitatively investigated. Increasing the number of temporary plugging balls appropriately can promote the uniform expansion of HFs, however, an excessive number may lead to over-plugging in high-flow clusters, negatively affecting their vertical development. Plugging timing is also crucial, conducting temporary plugging when the outer HFs have just penetrated the upper interface of the perforation layer is beneficial for the uniform expansion of multiple fractures. Based on these findings, optimized parameters have been proposed for different heterogeneous layered reservoirs. The recommended number of plugging balls for low and medium heterogeneity is 55%np \({\text{n}}_{\text{p}}\) and 60%np \({\text{n}}_{\text{p}}\) ( \({\text{n}}_{\text{p}}\text{ is}\) np is the total number of perforations), respectively, and the plugging timings are both 40%t \({t}_{\text{t}}\) ( \({t}_{\text{t}}\text{ is}\) t is the total fracturing time). In strongly heterogeneous reservoirs, where the stress interference between fractures is significant, it is necessary to appropriately increase the injection frequency and dynamically adjust the inflow differences of each perforation cluster. The suggested quantity of plugging balls is 60%np \({\text{n}}_{\text{p}}\) , with half injected at 30%t \({t}_{\text{t}}\) and the other half at 40%t \({t}_{\text{t}}\) . This study provides a meaningful perspective and optimal plugging parameters for the field design during TPDF.