In this paper, a sliding mode plus proportional-integral (PI) controller for a boost converter in a photovoltaic system is proposed. The proposed controller is characterized by being easy to implement and by operating with constant switching frequency. The parameters of the proposed controller are calculated using the weighted particle swarm optimization technique, ensuring low percentage of overshoot and short setting time. The use of this optimization technique allows one to ensure the stability of the controller. A linear lead-leg controller is considered in order to compare the performance of the proposed controller. Finally, experimental results using a solar kit are presented to verify the performance of the proposed controller.