Confocal microscopy enhances resolution by using a pinhole to eliminate out-of-focus light, resulting in sharper images. It enables the collection of optical sections from thick samples, which can be reconstructed into three-dimensional images. This technique is especially useful for studying the spatial organization of cells and tissues.