A novel controller is proposed to regulate the DC-link voltage of a single phase active power filter (SPAPF). The proposed switched fractional controller (SFC) consists of a conventional PI controller, a fractional order PI (FO-PI) controller and a decision maker that switches between them. Commonly, the conventional PI controller is used in regulation loops due to its advantages in steady-state but it is limited in transient state. On the other hand, the FO-PI controller overcomes these drawbacks but it causes dramatic degradation in control performances in steady-state because of the fractional calculus theory and the approximation method used to implement this kind of controller. Thus, the purpose of this paper is to switch to the PI controller in steady-state to obtain the best power quality and to switch to the FO-PI controller when external disturbances are detected to guarantee a fast transient state. To investigate the efficiency and accuracy of the SFC considering all robustness tests, an experimental setup has been established. The results of the SFC fulfill the requirements, confirm its high performances in steady and transient states and demonstrate its feasibility and effectiveness. The experiment results have satisfied the limit specified by the IEEE harmonic standard 519.