A system and method of estimating a distance between the distal end of an optical fiber and treated tissue, to improve treatment efficiency, is provided herein. The estimation is achieved by modulating the numerical aperture of a light beam transmitted through the fiber to receive reflections from the tissue and distinguish them from other reflections in the fiber, and further by calculating the distance by comparing reflection intensities of beams having different numerical aperture values that illuminate the tissue over a very short period, so that tissue and environment conditions do not change much. Distance estimation may be carried out by modulating the treatment beam itself, or by a light beam transmitted between pulses of a pulsed treatment beam.