ATPase component of the type IV pilus (T4P) that plays a role in surface and host cell adhesion, colonization, biofilm maturation, virulence, and twitching, a form of surface-associated motility facilitated by cycles of extension, adhesion, and retraction of T4P fibers (PubMed:15659660, PubMed:28854278). Acts as a molecular motor to provide the energy that is required for biogenesis of the pilus and the extrusion of substrates generated in the cytoplasm (PubMed:8102361, PubMed:18174131). PilB ATPase activity is also essential for T4P extension while antagonist PilT ATPase activity is required for T4P retraction (By similarity). Homohexamer (By similarity). Interacts with PilC (PubMed:23413032). Interacts with FimX; this interaction positively regulates T4P assembly and twitching motility by promoting the activity of the PilB ATPase (PubMed:28854278). Displays polar localization. The ATP-binding site is essential for assembly of pili. Mutants fail to make pili although synthesize wild-type levels of the pilin subunit PilA. Belongs to the GSP E family.