We report the cryo-EM structure of bacteriophage lambda and the mechanism for stabilizing the 20-A-thick capsid containing the dsDNA genome. The crystal structure of the HK97 bacteriophage capsid fits most of the T = 7 lambda particle density with only minor adjustment. A prominent surface feature at the 3-fold axes corresponds to the cementing protein gpD, which is necessary for stabilization of the capsid shell. Its position coincides with the location of the covalent cross-link formed in the docked HK97 crystal structure, suggesting an evolutionary replacement of this gene product in lambda by autocatalytic chemistry in HK97. The crystal structure of the trimeric gpD, in which the 14 N-terminal residues required for capsid binding are disordered, fits precisely into the corresponding EM density. The N-terminal residues of gpD are well ordered in the cryo-EM density, adding a strand to a beta-sheet formed by the capsid proteins and explaining the mechanism of particle stabilization.