Silicon photonic crystal (PhC) waveguide based resonator is designed by introducing a micro-cavity within the line defect so as to form the resonant band gap structure for PhC. Free-standing silicon beam comprising this nanophotonic resonator structure is investigated. The output resonant wavelength is sensitive to the shape of air holes and defect length of the micro-cavity. The resonant wavelength shift in the output spectrum is a function of force loading at the center of a suspended beam with PhC waveguide resonator. The sensing capability of this new nanomechanical sensor is derived as that vertical deformation is about 20nm at center and the smallest strain is 0.005% for defect length.