Diatoms with symbiotic N2-fixing cyanobacteria are often abundant in the oligotrophic open ocean gyres. The most abundant cyanobacterial symbionts form heterocysts (specialized cells for N2 fixation) and provide nitrogen (N) to their hosts, but their morphology, cellular locations and abundances differ depending on the host. Here we show that the location of the symbiont and its dependency on the host are linked to the evolution of the symbiont genome. The genome of Richelia (found inside the siliceous frustule of Hemiaulus) is reduced and lacks ammonium transporters, nitrate/nitrite reductases and glutamine:2-oxoglutarate aminotransferase. In contrast, the genome of the closely related Calothrix (found outside the frustule of Chaetoceros) is more similar to those of free-living heterocyst-forming cyanobacteria. The genome of Richelia is an example of metabolic streamlining that has implications for the evolution of N2-fixing symbiosis and potentially for manipulating plant-cyanobacterial interactions.