A matched filter is developed and applied to sonic waveforms for extracting reflected signals and minimizing borehole mode waves for S-wave sonic imaging using dipole sources. Sonic imaging uses waveforms acquired by a sonic logging tool in a fluid-filled borehole. Signals from a source are reflected from geological interfaces and recorded by arrays of receivers of the same tool. The reflected signals in the recorded waveforms are extracted and migrated to image geological structures. Because the reflected signals are covered by the strong borehole mode waves, they often are difficult to extract. To overcome this difficulty, a new matched filter has been developed. In the new matched filter, the second derivative of the driving waveform of the dipole source is used for the reference signal, and an average of spectral densities of array data is used to approximate those of the borehole mode waves, which are treated as noise. Because the spectral density of sonic waveforms generally varies for different time intervals, the matched filter is applied using a windowed approach. The matched filter effectively suppresses the borehole mode waves, and reflected signals are well conserved. Application of the matched filter is followed by additional filtering to further remove remaining borehole mode waves. The resulting reflected signals indicate high signal-to-noise ratio compared with those by existing filtering procedures without the matched filter. The use of the matched filter significantly increases applicability of sonic imaging by extracting weaker reflected signals that cannot be obtained by the existing filtering procedures.