As the causative agent of Glässer’s disease, Glaesserella (Haemophilus) parasuis has led to serious economic losses to the swine industry worldwide. Due to the low cross-protection of vaccines and increasing antimicrobial resistance of G. parasuis, it is important to develop alternative approaches to prevent G. parasuis infection. Defensins are host defense peptides that have been suggested to be promising substitutes for antibiotics in animal production, while porcine β-defensin 2 (PBD-2) is a potent antimicrobial peptide discovered in pigs. Our previous study generated transgenic (TG) pigs overexpressing PBD-2, which displayed enhanced resistance to Actinobacillus pleuropneumoniae. In this study, the antibacterial activities of PBD-2 against G. parasuis are determined in vitro and in the TG pig model. The concentration-dependent bactericidal activity of synthetic PBD-2 against G. parasuis was measured by bacterial counting. Moreover, after being infected with G. parasuis via a cohabitation challenge model, TG pigs overexpressing PBD-2 displayed significantly milder clinical signs and less severe gross pathological changes than their wild-type (WT) littermates. The TG pigs also exhibited alleviated lung and brain lesions, while bacterial loads in the lung and brain tissues of the TG pigs were significantly lower than those of the WT pigs. Additionally, lung and brain homogenates from TG pigs possessed enhanced antibacterial activity against G. parasuis when compared with those from the WT pigs. Altogether, these proved that overexpression of PBD-2 could also endow pigs with increased resilience to G. parasuis infection, which further confirmed the potential of using the PBD-2 coding gene to develop disease-resistant pigs and provided a novel strategy to combat G. parasuis as well.