In a group of order $pq^2$, if p divides $|Z(G)|$, then G is abelian I want to prove that in a group of order $pq^2$, if $p$ divides $|Z(G)|$, then $G$ is abelian.

I know that in this case, the order of $G/Z(G)$ must be $q^2$.

If $G/Z(G)\simeq \mathbb{Z}/{q^2}\mathbb{Z}$, then we are done, because $\mathbb{Z}/{q^2}\mathbb{Z}$ is cyclic.

But what happens if $G/Z(G)\simeq \mathbb{Z}/{q}\mathbb{Z}\times \mathbb{Z}/{q}\mathbb{Z}$? I think I'm missing something trivial..
You do not know that $G/Z(G)$ must have order $q^2$. In fact you are try to prove $G$ is abelian, which implies $Z(G) = G$ so you are actually trying to show $G/Z(G)$ has order $1$.

Note that since $p$ divides $|Z(G)|$, a sylow $p$, $S_p$ is central. Thus $1 \to S_p \to G \to G/S_p \to1$ is a short exact sequence with $S_p$ central and $G/S_p$ nilpotent (order $q^2$ is abelian). It follows that $G$ is nilpotent, and hence is the product of its Sylow subgroups $G = S_p \times S_q$ and $S_q$ has order $q^2$ and is hence abelian.
Clearly $|Z(G)|=p$ and index$[G:Z(G)]=q^2$, so $Z(G)$ is normal Hall-subgroup. By the theorem of Schur-Zassenhaus it has a complement $H$, so $G=HZ(G)$, $H \cap Z(G) =1$. Hence $|H|=q^2$ and $H$ is abelian. But then $G=HZ(G)$ must be abelian.

Note without Schur-Zassenhaus: in general if $G/Z(G)$ is abelian, then $G$ is nilpotent. And hence $G$ is the direct product of its Sylow subgroups. In this case it follows that $G$ is abelian. By the way note that you must assume that $p \neq q$, otherwise the statement of the OP is not true.