Photovoltaic (PV) inverters essentially convert DC quantities, such as voltage and current, to AC quantities whose magnitude and frequency are controlled to obtain the desired output. Thus, the performance of an inverter depends on its controller. Therefore, an optimum fuzzy logic controller (FLC) design technique for PV inverters using a lightning search algorithm (LSA) is presented in this study. In a conventional FLC, the procedure for obtaining membership functions (MFs) is usually implemented using trial and error, which does not lead to satisfactory solutions in many cases. Therefore, this study presents a technique for obtaining MFs that avoids the exhaustive traditional trial-and-error procedure. This technique is implemented during the inverter design phase by generating adaptive MFs based on the evaluation results of the objective function formulated with LSA. The mean squared error (MSE) of the inverter output voltage is used as an objective function in this study. LSA optimizes the MFs such that the inverter provides the lowest MSE for the output voltage, and the performance of the PV inverter output is improved in terms of amplitude and frequency. First, the design procedure and accuracy of the optimum FLC are illustrated and investigated through simulations conducted in a MATLAB environment. The LSA-based FLC (LSA-FL) are compared with differential search algorithm (DSA)-based FLC (DSA-FL) and particle swarm optimization (PSO)-based FLC (PSO-FL). Finally, the robustness of the LSA-FL is further investigated with a hardware that is operated via an eZdsp F28335 control board. Simulation and experimental results show that the proposed controller can successfully obtain the desired output when different loads are connected to the system. The inverter also has a reasonably low steady-state error and fast response to reference variation.