We study in detail the relationship between the Tavis-Cummings Hamiltonian of quantum optics and a family of quasi-exactly solvable Schrodinger equations. The connection between them is stablished through the biconfluent Heun equation. We found that each invariant $n$-dimensional subspace of Tavis-Cummings Hamiltonian corresponds either to $n$ potentials, each with one known solution, or to one potential with $n$-known solutions. Among these Schrodinger potentials appear the quarkonium and the sextic oscillator.