Estimating spectral gaps of quantum many-body Hamiltonians is a highly challenging computational task, even under assumptions of locality and translation-invariance. Yet, the quest for rigorous gap certificates is motivated by their broad applicability, ranging from many-body physics to quantum computing and classical sampling techniques. Here we present a general method for obtaining lower bounds on the spectral gap of frustration-free quantum Hamiltonians in the thermodynamic limit. We formulate the gap certification problem as a hierarchy of optimization problems (semidefinite programs) in which the certificate – a proof of a lower bound on the gap – is improved with increasing levels. Our approach encompasses existing finite-size methods, such as Knabe’s bound and its subsequent improvements, as those appear as particular possible solutions in our optimization, which is thus guaranteed to either match or surpass them. We demonstrate the power of the method on one-dimensional spin-chain models where we observe an improvement by several orders of magnitude over existing finite size criteria in both the accuracy of the lower bound on the gap, as well as the range of parameters in which a gap is detected.