An improvement to the currently used ac impedance detection method for tip-sample distance control in near-field scanning optical microscopes is described and demonstrated. The output signal of the electronic bridge is increased by a factor of 5000 so that a root-mean-square chip can be used in place of sensitive lock-in detection. It is shown that the signal-to-noise ratio of this new method is high enough to detect 0.07 nm changes in topography. In addition, this modification makes the electronics for the shear force feedback compact and inexpensive. (C) 1997 American Institute of Physics.