We propose a self-aligned microlens fabricated on the sidewall of an optical fiber for a compact and high-throughput scanning optical microscopy (SNOM) application. The end face of the optical fiber is polished to have 45° for total internal reflection, and the microlens is fabricated on the sidewall of the optical fiber by exposing photoresist with ultraviolet light guided along the optical fiber. This method requires no active alignment and is compatible with standard photolithography. The microlens effectively focuses the illumination light emanating from the 45°-angled fiber, resulting in a beam radius of 1.1 μm at the focal length of 22.5 μm. When an SNOM probe has an aperture size of 143 nm and the input optical power to the SNOM probe is 400 μW, the optical throughput (the ratio of output to input power) is as high as 2.5×10-4, which is five times higher than without a microlens.