An inverse correlation was observed between eruption frequency and ground surface deformation of Sakurajima volcano (Japan) during November 2018 to April 2021. Over the same period, the mass density of magma in the upper conduit of the active crater was monitored via muography. Mass density increased significantly during inflation, when eruption frequency was low, and decreased during deflation, when eruption frequency was high. On the basis of the muography data, we find that periods of low eruption frequency are associated with the formation of a dense plug in the shallow conduit, which we infer caused inflation of the edifice by trapping pressurized magmatic gas. Conversely, periods of high eruption frequency are associated with the absence of a dense plug, which we infer allows gas to escape, leading to deflation. Muography thus reveals the in-conduit physical mechanism for the observed correlation, with implications for interpretation of deformation at other volcanoes.