The emerging global wave energy industry has great potential to contribute to the world’s energy needs. However, one of the key challenges in designing a wave energy converter (WEC) is the wave energy generator. Thus, this paper focuses on the optimal design of a cylindrical permanent magnet linear generator (CPMLG), which is used for the wave energy conversion system. To reduce the end effect and enhance the magnetic field performance of the CPMLG, the level-set method is applied to the design of the topology and size for the generator. In the paper, the objective air gap magnetic field is given by the mathematical analysis method and appropriate measuring points are predetermined. The measuring points can fully reflect the distribution characteristics of the air gap magnetic field. Then, topology evolution on the permanent magnet (PM) and yoke based on the level-set method are performed. The level set function corresponding to the initial shape of the PM is constructed. The algorithm is programmed and computed iteratively using the discrete time and space variables. Finally, the performances of the CPMLG with the updated PM and width of yoke are analyzed by ANSYS Maxwell. Results show that the magnetic field distortion and the unbalance of three-phase electromotive force (EMF) of the CPMLG is reduced by the optimization of the level-set method. It has also been verified that the designed CPMLG with the level-set method could be used for WEC at different wave conditions.