The invention relates to a method for reducing fouling in a microbial fuel cell. The method comprises feeding of an influent comprising organic substance(s) into the microbial fuel cell (MFC), which comprises an anode and a cathode connected through an external electrical circuit with each other. Organic substance(s) are converted into electrical energy in the microbial fuel cell by using microorganisms, such as exoelectrogenic bacteria, and a treated flow is removed from the microbial fuel cell. A cleaning agent composition is fed simultaneously with the influent to the microbial fuel cell. The invention relates also to the cleaning agent composition and its use.