In this work an approximate analytic expression for the quantum partition function of the quartic oscillator described by the potential \(V(x) = \frac{1}{2} \omega ^2 x^2 + g x^4\) is presented. Using a path integral formalism, the exact partition function is approximated by the partition function of a harmonic oscillator with an effective frequency depending both on the temperature and coupling constant g. By invoking a Principle of Minimal Sensitivity (PMS) of the path integral to the effective frequency, we derive a mathematically well-defined analytic formula for the partition function. Quite remarkably, the formula reproduces qualitatively and quantitatively the key features of the exact partition function. The free energy is accurate to a few percent over the entire range of temperatures and coupling strengths g. Both the harmonic ( \(g\rightarrow 0\) ) and classical (high-temperature) limits are exactly recovered. The divergence of the power series of the ground-state energy at weak coupling, characterized by a factorial growth of the perturbational energies, is reproduced as well as the functional form of the strong-coupling expansion along with accurate coefficients. Explicit accurate expressions for the ground- and first-excited state energies, \(E_0(g)\) and \(E_1(g)\) are also presented.