In this paper, we present the design and optimization of a rectangular piezoresistive composite silicon dioxide nanocantilever sensor. Unlike the conventional design approach, we perform the sensor optimization by not only considering its electro-mechanical response but also incorporating the impact of self-heating induced thermal drift in its terminal characteristics. Through extensive simulations first we comprehend and quantify the inaccuracies due to self-heating effect induced by the geometrical and intrinsic parameters of the piezoresistor. Then, by optimizing the ratio of electrical sensitivity to thermal sensitivity defined as the sensitivity ratio (υ) we improve the sensor performance and measurement reliability. Results show that to ensure υ ≥ 1, shorter and wider piezoresistors are better. In addition, it is observed that unlike the general belief that high doping concentration of piezoresistor reduces thermal sensitivity in piezoresistive sensors, to ensure υ ≥ 1 doping concentration (p) should be in the range: 1E18 cm-3 ≤ p ≤ 1E19 cm-3. Finally, we provide a set of design guidelines that will help NEMS engineers to optimize the performance of such sensors for chemical and biological sensing applications.