The efficiency of solar photovoltaic (PV) systems is directly affected by the convergence and steady-state responses of the implemented control method. In this paper, considering the nonlinearity appearing in the model of the solar PV system, we employ a nonlinear optimal feedback control scheme to deal with the oscillations around the maximum power point (MPP) of the system, induced by the chattering phenomenon in the control. Taking into account the improved transient response and flexibility, brought by including the cross-weighting terms in the cost functional, we develop an optimal control framework with a nonquadratic cost for addressing the MPP tracking (MPPT) problem of the solar PV system. Exploiting the fact that a Lyapunov function candidate can be considered as the steady-state solution of the Hamilton-Jacobi-Bellman (HJB) equation, we obtained the optimal feedback controller via minimizing the resultant Hamiltonian. The stability analysis of the closed-loop system is done for the obtained control law with a guaranteed performance measure. Moreover, to enhance the practicality of the obtained control law, we present two procedures to implement the obtained control scheme under nonuniform insolation and as a model-free approach, separately. To demonstrate the merits of the proposed framework, the obtained optimal feedback control, together with the partial shading condition and model-free approach, is simulated under various weather conditions. The optimal approach illustrates an improved performance in terms of the convergence rate and the amplitude of oscillations around the MPP, compared to existing results in the literature.