Cilia build distinct subdomains with variable axonemal structures to perform diverse functions in cell motility and signaling. In sensory cilia across species, an axoneme differentiates longitudinally into a middle segment with nine microtubule (MT) doublets and a distal segment with nine MT singlets that extends from the A tubules of the doublets. Here, we study axoneme differentiation in Caenorhabditis elegans by analyzing the flagellar inner junction protein FAP20 and PCRG1 that connect A and B tubules in Chlamydomonas. The nematode CFAP-20 is restricted to the middle segment with doublets, and its loss disconnects A and B tubules. However, PCRG-1 is absent from most sensory cilia, and its deletion does not disrupt cilia. Ectopic introduction of PCRG-1 into cilia generated abnormal MT doublets in the distal segment and reduced intraflagellar transport and animal sensation. Thus, the absence of an inner junction protein prevents B-tubule extension, which contributes to axoneme differentiation and ciliary function.