We present a robust, "real-time" optical autofocus system for microscopy that provides high accuracy (<230 nm) and long range (~130 μm) with a 1.4 numerical aperture oil immersion objective lens. This autofocus can operate in a closed loop, single-shot functionality over a range of ±37.5 μm and can also operate as a 2-step process up to ±68 μm. A real-time autofocus capability is useful for experiments with long image data acquisition times, including single molecule localization microscopy, that may be impacted by defocusing resulting from drift of components, e.g., due to changes in temperature or mechanical drift. It is also vital for automated slide scanning or multiwell plate imaging where the sample may not be in the same horizontal plane for every field of view during the image data acquisition. To realise high precision and long range, we implement orthogonal optical readouts using cylindrical lenses. We demonstrate the performance of this new optical autofocus system with automated multiwell plate imaging and single molecule localisation microscopy and illustrate the benefit of using a superluminescent diode as the autofocus light source.