The evolution of complex nervous systems was accompanied by the expansion of numerous protein families, including cell-adhesion molecules, surface receptors, and their ligands. These proteins mediate axonal guidance, synapse targeting, and other neuronal wiring-related functions. Recently, 32 interacting cell surface proteins belonging to two newly defined families of the Ig superfamily (IgSF) in fruit flies were discovered to label different subsets of neurons in the brain and ventral nerve cord. They have been shown to be involved in synaptic targeting and morphogenesis, retrograde signaling, and neuronal survival. Here, we show that these proteins, Dprs and DIPs, are members of a widely distributed family of two- and three-Ig domain molecules with neuronal wiring functions, which we refer to as Wirins. Beginning from a single ancestral Wirin gene in the last common ancestor of Bilateria, numerous gene duplications produced the heterophilic Dprs and DIPs in protostomes, along with two other subfamilies that diversified independently across protostome phyla. In deuterostomes, the ancestral Wirin evolved into the IgLON subfamily of neuronal receptors. We show that IgLONs interact with each other and that their complexes can be broken by mutations designed using homology models based on Dpr and DIP structures. The nematode orthologs ZIG-8 and RIG-5 also form heterophilic and homophilic complexes, and crystal structures reveal numerous apparently ancestral features shared with Dpr-DIP complexes. The evolutionary, biochemical, and structural relationships we demonstrate here provide insights into neural development and the rise of the metazoan nervous system.