The effect of self-focusing and defocusing on terahertz (THz) generation by amplitude-modulated Gaussian laser beam in rippled density plasma is investigated. A stronger transient transverse current is generated by transverse component of ponderomotive force exerted by laser on electrons that drives radiation at the modulation frequency (which is chosen to be in the THz domain) because of the variation in intensity in the direction transverse to the laser propagation. Numerical simulations indicate the enhancement of THz yield by many folds due to self-focusing of laser beam in comparison with that without self-focusing. The transient focusing of laser beam and its effect on the generated THz amplitude has also been studied.