This study primarily concentrates on the layer optimization and structural refinement of carbon fiber composite B-pillars. In the initial phase, an initial layer configuration for the carbon fiber composite material B-pillar was devised, followed by comprehensive finite element numerical simulations. The weight of the B-pillar was effectively diminished by 44.9% compared to its metal counterpart, while maintaining consistent performance across diverse operational conditions. Subsequently, an advanced layer thickness optimization model was formulated, incorporating the innovative "super layer" concept. Integration of simulation software, such as ISIGHT and ABAQUS, facilitated the determination of optimal layer thickness and ratio for the composite material. The layer order was systematically optimized through the application of a discrete particle swarm optimization algorithm based on exchange order, adeptly addressing issues related to discontinuous design variables and potential combinations. The incorporation of a ply drop-off structure laying scheme was derived, resulting in an impressive weight reduction of 57.5%. In the final phase, adherence to NCAP side collision testing standards enabled a comprehensive evaluation, wherein various indicators including deformation mode, intrusion amount, and intrusion speed were employed. The results substantiate that the composite B-pillar exhibits equivalent side impact resistance to the original metal B-pillar, ensuring robust passenger protection.