  We prove upper bounds for the mean square of the remainder in the prime
geodesic theorem, for every cofinite Fuchsian group, which improve on average
on the best known pointwise bounds. The proof relies on the Selberg trace
formula. For the modular group we prove a refined upper bound by using the
Kuznetsov trace formula.
