Cytosolic DNA arising from intracellular pathogens triggers a powerful innate immune response1,2. It is sensed by cyclic GMP–AMP synthase (cGAS), which elicits the production of type I interferons by generating the second messenger 2′3′-cyclic-GMP–AMP (cGAMP)3,4,5. Endogenous nuclear or mitochondrial DNA can also be sensed by cGAS under certain conditions, resulting in sterile inflammation. The cGAS dimer binds two DNA ligands shorter than 20 base pairs side-by-side6,7,8,9, but 20-base-pair DNA fails to activate cGASin vivoand is a poor activatorin vitro. Here we show that cGAS is activated in a strongly DNA length-dependent manner bothin vitroand in human cells. We also show that cGAS dimers form ladder-like networks with DNA, leading to cooperative sensing of DNA length: assembly of the pioneering cGAS dimer between two DNA molecules is ineffective; but, once formed, it prearranges the flanking DNA to promote binding of subsequent cGAS dimers. Remarkably, bacterial and mitochondrial nucleoid proteins HU and mitochondrial transcription factor A (TFAM), as well as high-mobility group box 1 protein (HMGB1), can strongly stimulate long DNA sensing by cGAS. U-turns and bends in DNA induced by these proteins pre-structure DNA to nucleate cGAS dimers. Our results suggest a nucleation-cooperativity-based mechanism for sensitive detection of mitochondrial DNA10and pathogen genomes11, and identify HMGB/TFAM proteins as DNA-structuring host factors. They provide an explanation for the peculiar cGAS dimer structure and suggest that cGAS preferentially binds incomplete nucleoid-like structures or bent DNA.