Bosonic atoms confined in optical lattices can exist in two different phases, Mott insulator and superfluid, depending on the strength of the system parameters, such as the on-site interaction between particles and the hopping parameter. This work is motivated by the fact that nondegenerate perturbation theory applied to the mean-field approximation of the Bose-Hubbard Hamiltonian at both zero and finite temperature fails to give consistent results in the vicinity of the Mott insulatorsuperfluid phase transition, e.g., the order parameter calculated via nondegenerate perturbation theory reveals an unphysical behavior between neighboring Mott lobes, which is an explicit consequence of degeneracy problems that artificially arise from such a treatment. Therefore, in order to fix this problem, we propose a finite-temperature degenerate perturbation theory approach based on a projection operator formalism which ends up solving such degeneracy problems in order to obtain physically consistent results for the order parameter near the phase transition.