  We prove an asymptotic expansion of the second moment of the central values
of the $\mathrm{GL}(n)\times\mathrm{GL}(n)$ Rankin--Selberg $L$-functions
$L(1/2,\pi\otimes\pi_0)$, for a fixed cuspidal automorphic representation
$\pi_0$, over the family of $\pi$ with analytic conductors bounded by a
quantity which is tending off to infinity. Our proof uses the integral
representations of the $L$-functions, period with regularized Eisenstein
series, and the invariance properties of the analytic newvectors.
