4. Let $\left\{a_{n}\right\}(n \geqslant 1)$ be a sequence of non-negative numbers with the first term $a$, and the sum of the first $n$ terms be $S_{n}$, and $S_{n}=\left(\sqrt{S_{n-1}}+\sqrt{a}\right)^{2}(n \geqslant 2)$. If $b_{n}=\frac{a_{n+1}}{a_{n}}+\frac{a_{n}}{a_{n+1}}$, and the sum of the first $n$ terms of the sequence $\left\{b_{n}\right\}$ is $T_{n}$, then $T_{n}=$ . $\qquad$
4. $\frac{4 n^{2}+6 n}{2 n+1}$.

From $S_{n}=\left(\sqrt{S_{n-1}}+\sqrt{a}\right)^{2}$, we get
$$
\sqrt{S_{n}}=\sqrt{S_{n-1}}+\sqrt{a} \text {. }
$$

Also, $\sqrt{S_{1}}=\sqrt{a_{1}}=\sqrt{a}$, so $\left\{\sqrt{S_{n}}\right\}$ is an arithmetic sequence with the first term $\sqrt{a}$ and common difference $\sqrt{a}$, that is
$$
\begin{array}{l}
\sqrt{S_{n}}=\sqrt{a}+(n-1) \sqrt{a}=n \sqrt{a} \\
\Rightarrow S_{n}=a n^{2} .
\end{array}
$$
$$
\begin{array}{l}
\text { Then } a_{n}=S_{n}-S_{n-1}=a n^{2}-a(n-1)^{2} \\
=2 a n-a, \\
b_{n}=\frac{a_{n+1}}{a_{n}}+\frac{a_{n}}{a_{n+1}} \\
=\frac{2 a(n+1)-a}{2 a n-a}+\frac{2 a n-a}{2 a(n+1)-a} \\
=\frac{2 n+1}{2 n-1}+\frac{2 n-1}{2 n+1} \\
=2+2\left(\frac{1}{2 n-1}-\frac{1}{2 n+1}\right) .
\end{array}
$$

Therefore, $T_{n}=b_{1}+b_{2}+\cdots+b_{n}$
$$
=2 n+2\left(1-\frac{1}{2 n+1}\right)=\frac{4 n^{2}+6 n}{2 n+1} \text {. }
$$