Stiffness tuning is crucial for micro/nanoscale devices to achieve advanced functionalities such as bistability, which enables efficient energy harvesting, large motion actuation, and programmable mechanical properties. Prestress implemented by thin films is one of the effective approaches for stiffness control; however, it is rarely used in practice because of the poor controllability in traditional thin film materials. Here, we demonstrate robust stiffness tuning on a microelectromechanical system (MEMS) sensor by using prestress in titanium nitride (TiN) thin films. Benefiting from the atomic peening effect, TiN exhibits linearly controllable prestress, which provides direct access to zero and negative stiffness in the mechanical device, resulting in multiple functionalities, including significantly enhanced sensitivity near zero-stiffness and bistable snapping behavior as stiffness becomes negative. The demonstrated technique can be a powerful tool to manipulate mechanical behaviors and facilitate exceptional sensing and actuating functionalities for micro/nanoscale devices.