A pressure sensor based on two dimensional photonic crystal structure is presented. The structure considered for sensing is a lattice of air holes surrounded by semiconductor material. A waveguide with central microcavity is formed by filling air holes with semiconductor material. The sensing principle depends upon the shifting of central wavelength of peak towards higher wavelength region when the pressure is raised. The proposed pressure sensor can work in the range 0-5 GPa. Using this structure, two semiconductors, Si and GaAs, have been taken for analysis. It is found that shifting of resonance wavelength with pressure is more pronounced in GaAs than Si. In the dynamic range 0-5 GPa, sensitivity for sensor with Si is estimated as 1.674 nm/GPa while it is 17.00 nm/GPa for sensor with GaAs. The quality factor and figure of merit (FOM) is also found to be higher for GaAs sensor.