The proton charge radius inferred from muonic hydrogen spectroscopy is not compatible with the previous value given by CODATA-2010, which, on its turn, essentially relies on measurements of the electron-proton interaction. The proton's new size was extracted from the 2S-2P Lamb shift in the muonic hydrogen, which showed an energy excess of 0.3 meV in comparison to the theoretical prediction, evaluated with the CODATA radius. Higher-dimensional gravity is a candidate to explain this discrepancy, since the muonproton gravitational interaction is stronger than the electronproton interaction and, in the context of braneworld models, the gravitational potential can be hugely amplified in short distances when compared to the Newtonian potential. Motivated by these ideas, we study a muonic hydrogen confined in a thick brane. We show that the muon-proton gravitational interaction modified by extra dimensions can provide the additional separation of 0.3 meV between the 2S and 2P states. In this scenario, the gravitational energy depends on the higher-dimensional Planck mass and indirectly on the brane thickness. Studying the behavior of the gravitational energy with respect to the brane thickness in a realistic range, we find constraints for the fundamental Planck mass that solve the proton radius puzzle and are consistent with previous experimental bounds.