Bilobate comets—small icy bodies with two distinct lobes—are a common configuration among comets, but the factors shaping these bodies are largely unknown. Cometary nuclei, the solid centres of comets, erode by ice sublimation when they are sufficiently close to the Sun, but the importance of a comet’s internal structure on its erosion is unclear. Here we present three-dimensional analyses of images from the Rosetta mission to illuminate the process that shaped the Jupiter-family bilobate comet 67P/Churyumov–Gerasimenko over billions of years. We show that the comet’s surface and interior exhibit shear-fracture and fault networks, on spatial scales of tens to hundreds of metres. Fractures propagate up to 500 m below the surface through a mechanically homogeneous material. Through fracture network analysis and stress modelling, we show that shear deformation generates fracture networks that control mechanical surface erosion, particularly in the strongly marked neck trough of 67P/Churyumov–Gerasimenko, exposing its interior. We conclude that shear deformation shapes and structures the surface and interior of bilobate comets, particularly in the outer Solar System where water ice sublimation is negligible.