Toll-like receptor (TLR) signaling is a key innate immunity response to pathogens. Recruitment of signaling adapters such as MAL (TIRAP) and MyD88 to the TLRs requires Toll/interleukin-1 receptor (TIR)-domain interactions, which remain structurally elusive. Here we show that MAL TIR domains spontaneously and reversibly form filaments in vitro. They also form cofilaments with TLR4 TIR domains and induce formation of MyD88 assemblies. A 7-Å-resolution cryo-EM structure reveals a stable MAL protofilament consisting of two parallel strands of TIR-domain subunits in a BB-loop-mediated head-to-tail arrangement. Interface residues that are important for the interaction are conserved among different TIR domains. Although large filaments of TLR4, MAL or MyD88 are unlikely to form during cellular signaling, structure-guided mutagenesis, combined with in vivo interaction assays, demonstrated that the MAL interactions defined within the filament represent a template for a conserved mode of TIR-domain interaction involved in both TLR and interleukin-1 receptor signaling.