Erbium-doped fiber amplifiers (EDFA) must have a flat gain profile which is a very important parameter such as wavelength division multiplexing (WDM) and dense WDM (DWDM) applications for long-haul optical communication systems and networks. For this reason, it is crucial to hold a stable signal power per optical channel. For the purpose of overcoming performance decline of optical networks and long-haul optical systems, the gain of the EDFA must be controlled for it to be fixed at a high speed. In this study, due to the signal power attenuation in long-haul fiber optic communication systems and non-equal signal amplification in each channel, an automatic gain controller (AGC) is designed based on the adaptive neuro-fuzzy inference system (ANFIS) for EDFAs. The intelligent gain controller is implemented and the performance of this new electronic control method is demonstrated. The proposed ANFIS-based AGC-EDFA uses the experimental dataset to produce the ANFIS-based sets and the rule base. Laser diode currents are predicted within the accuracy rating over 98 percent with the proposed ANFIS-based system. Upon comparing ANFIS-based AGC-EDFA and experimental results, they were found to be very close and compatible.