Nontypeable Haemophilus influenzae (NTHi) strains form a major group of pathogenic bacteria that colonizes the nasopharynx and causes otitis media in young children. At present, there is no licensed vaccine for NTHi. Because NTHi colonizes the upper respiratory tract and forms biofilms that cause subsequent infectious events, a nasal vaccine that induces NTHi-specific secretory IgA capable of preventing biofilm formation in the respiratory tract is desirable. Here, we developed a cationic cholesteryl pullulan–based (cCHP nanogel) nasal vaccine containing the NTHi surface antigen P6 (cCHP-P6) as a universal vaccine antigen, because P6 expression is conserved among 90% of NTHi strains. Nasal immunization of mice with cCHP-P6 effectively induced P6-specific IgA in mucosal fluids, including nasal and middle ear washes. The vaccine-induced P6-specific IgA showed direct binding to the NTHi via the surface P6 proteins, resulting in the inhibition of NTHi biofilm formation. cCHP-P6 nasal vaccine thus protected mice from intranasal NTHi challenge by reducing NTHi colonization of nasal tissues and eventually eliminated the bacteria. In addition, the vaccine-induced IgA bound to different NTHi clinical isolates from patients with otitis media and inhibited NTHi attachment in a three-dimensional in vitro model of the human nasal epithelial surface. Therefore, the cCHP-P6 nanogel nasal vaccine induced effective protection in the airway mucosa, making it a strong vaccine candidate for preventing NTHi-induced infectious diseases, such as otitis media, sinusitis, and pneumonia.