We present design and simulation results of a novel nanomechanical sensor using a silicon cantilever comprising two-dimensional (2-D) photonic crystal (PC) microcavity resonator structure. A U-shaped silicon line defect in a 2-D photonic crystal is considered as a waveguide for confining light propagation within waveguide, while two-hole pairs are placed along this silicon waveguide as a optical reflector. The resonant wavelength of output spectrum is sensitive to the shape of air holes and defect length of the microcavity resonator. The minimum detectable strain, vertical deflection at the cantilever end, and force load are observed as 0.0136%, 0.94(j.m and 0.046 jiN for 50(xm cantilever. The measured strain is a linear function of resonant wavelength shift and applied force. This new sensing shows promising features for biomolecules detection.