Second and third harmonic generations (SHG and THG) have been widely utilized in multiphoton microscopy. However, the origin of the contrast signals and the impact of phase matching in imaging tissues is still not well understood. This study presents theoretical analyses of harmonics generation with a focused Gaussian beam. Analytical solutions are obtained for the integral of the phase-matching factor which can be applied to various focusing and sample conditions. Our results show that the phase matching condition is relaxed and reasonable SHG and THG efficiency can be excited near interfaces or for thin samples with normal dispersion. An optimization process of the confocal parameter is proposed based on the properties of the sample. Multimodal label-free imaging which combines SHG, THG, and two-photon excitation fluorescence is demonstrated on biological samples for acquiring complementary information about tissues.