The Sine-Cosine algorithm (SCA) is efficient but faces challenges in exploitative abilities, slow convergence, and exploration-exploitation balance. This study proposes a novel optimization method, the learning-based sine-cosine algorithm (L-SCA), to solve the optimal power flow (OPF) problem. The basic SCA has been modified with a learning phase operator inspired by TLBO. The SCA handles global exploration, while the learner phase of teaching-learning based optimization (TLBO) offers strong local search capabilities, which can be utilized to enhance the solution neighborhood space provided by the SCA technique. The L-SCA and original SCA algorithms address OPF in IEEE 57-bus, Algerian 59-bus, and IEEE 118-bus power systems, considering twelve cases with a focus on cost savings, voltage stability, voltage profile, emissions, and power losses. The comparative study shows that the proposed L-SCA consistently outperforms standard SCA and other reported methods in all cases for varied-scale standard test systems as well as for a practical power system, within reasonable execution times. For instance, L-SCA in the Algerian 59-bus system cut fuel costs by around 13.13% compared to initial case, equating to annual savings of $2.2 million, while in the IEEE-118 bus system, power loss is significantly reduced to 17.881 MW, marking an 86.5% reduction compared to the base case.