Concentration quenching effects of identical rare earth (RE) activator ions and energy transfer (ET) between different RE ions often compromise the photoluminescence (PL) quantum efficiency in RE based luminescence materials. Here, we demonstrate that in NaGd(WO4)2:Tb(3+), Eu(3+) inverse opal photonic crystals (IOPCs), the suppression of the emission line located in the photonic stop band (PSB) and a dramatic increase of the lifetimes of Eu(3+) and Tb(3+) ions are observed. More interestingly, the concentration quenching among Eu(3+) ions and ET from Tb(3+) to Eu(3+) is significantly relieved owing to the periodic empty cavity structure of IOPCs. As a consequence, the luminescent quantum efficiency (QE) of the NaGd(WO4)2:Tb(3+), Eu(3+) IOPCs increases ���2 times more than that of crushed NaGd(WO4)2:Tb(3+), Eu(3+) powder. In addition, a reusable pH sensor with good linear response (pH 5-10) has been designed based on the high surface-to-volume ratio, high connectivity, and enhanced luminescence of NaGd(WO4)2:Tb(3+), Eu(3+)IOPCs, which could be applied to the dynamical detection of pH value.