Peony seed meal is produced annually on a large scale in China, resulting in considerable solid residue. Unfortunately, most of this residue is discarded, thereby creating environmental pressure. However, the untapped medicinal value of peony seed meal prompted us to establish an efficient methodology for optimizing the extraction and purification of total alkaloid, followed by a detailed analysis of its biological activities. A single-factor experiment and an orthogonal test were used to identify the optimal extraction parameters. Then, further optimization was performed using the response surface methodology. The extract was enriched using D-101 macroporous adsorption resin. Subsequently, silica gel column chromatography was used for separation, and high-performance liquid chromatography was used for further separation and quantification. Meanwhile, gas chromatography–mass spectrometry (GC–MS) was used to identify alkaloid components. Finally, the antibacterial and anti-inflammatory were evaluated. The optimal extraction conditions substantially improved the yield of alkaloids. A total of 15 alkaloids were separated. GC–MS analysis revealed the presence of Sophoridine, which accounted for 91.88 % of the total alkaloid content. The antibacterial activity of the total alkaloid was tested, and the lowest inhibitory concentrations of E. coli ATCC 25922 and S. aureus ATCC 29213 were 0.04516 and 0.05645 mg/mL, respectively. Additionally, total alkaloid had an inhibitory effect on ear swelling induced by xylene and toe swelling induced by egg white, reducing by 80 % and 24 %, respectively. The current research discovered the antibacterial activity of PSM alkaloid, which has important practical significance for the research and development of new plant-derived antibacterial agents.