Extended depth-of-focus (EDOF) diffractive lenses produce a narrow and long focusing region which have many applications on microscopy, laser focusing or contact and intraocular lenses. Several designs have been proposed to achieve EDOF by angularly modulating the focal length. Nevertheless, when the focus is highly elongated, some undesired intensity fluctuations are produced. To solve this problem, we have generalized this type of lenses by defining their focal length as a Fourier series. Moreover, we have used Particle Swarm Optimization algorithm to optimize its Fourier series coefficients and generate an enhanced design. The performance of our Fourier Series Diffractive Lens (FSDL) is parameterized through the Full Width at Half Maximum (FWHM) of the beam and the uniformity of the intensity along the optical axis. Our results prove that the FSDL beam on the focal region is narrower and much more uniform than previous EDOF designs, showing the enhancement of the proposed EDOF lens.