Easier question
An easier question is, “If H is maximal amongst all abelian subgroups of G, then $C_G(H)=H$.”
Proof: Since H is abelian, $H \leq C_G(H)$, so we just need to rule out $H < C_G(H)$. Let $z \in C_G(H)$. Then $M = \langle H,z \rangle$ is abelian, since $z$ commutes with everything in $H$, and certainly commutes with itself. $H$ is central in $M$, and $M/H$ is cyclic (generated by $zH$), so $M$ is abelian. Thus $M=H$ by maximality and $z \in H$ and $C_G(H) \leq H$. Yay! $\square$
Your question
The problem with our proof for the question as asked is that $H$ is only assumed maximal amongst the normal abelian subgroups. Our “$M$” need not have been normal. We'd like to know that we can find some normal subgroup $M$ containing $H$ as a central subgroup with $M/H$ cyclic. How do we get such a small normal subgroup?
Non-identity normal subgroups of $p$-groups intersect the center nontrivially, so we know that in the group $G/H$, $C_G(H)/H$ must either be the identity, or it must contain a central element of order $p$, which will be our $zH$!
Generalization
We begin by deciding which techniques are needed. The question could be asked for any group, but is only asked for $p$-groups. Why? Well, the conclusion is not true in general. The groups $\newcommand{\SL}{\operatorname{SL}}G=\SL(2,q)$ for $q \geq 3$ an odd prime power have only $H=Z(G)$ as a non-identity normal, abelian subgroup. Since $C_G(Z(G))=G$, clearly these groups violate the conclusion and so we must need to use some special property of $p$-groups. Since $\SL(2,3)$ is solvable, but not supersolvable we make the following conjecture (after checking for small counterexamples):
Proposition: If G is a supersolvable group and H ≤ G is maximal amongst abelian normal subgroups, then H is its own centralizer in G.
Indeed our proof is going to be the same: we just need to know that there is some $M/H$ with $M$ normal and $M/H$ cyclic. In a supersolvable group, the minimal normal subgroups are always cyclic.
Proof: Let $K=C_G(H)$ be the centralizer of H in G. Since H is normal in G, K is also normal in G. Since H is abelian, H ≤ K, and so we just need to rule out the possibility that H < K. Hence we consider $K/H \leq G/H$. Assume by way of contradiction that $K/H \neq 1$. Then $G/H$ has a minimal normal subgroup $M/H$ contained in $K/H$. Since $G$ is supersolvable and $M/H$ is a chief factor of $G$, $M/H$ is cyclic. Since $M \leq K$, $H$ is central in $M$, and so $M$ is an extension of its central subgroup $H$ by a cyclic group $M/H$. By the well known exercise, $M$ is abelian. Since $M$ is normal as well, this is a contradiction. $\square$
More generally, we just need G to act supersolvably on its Fitting subgroup. You can even allow the group to be infinite, though one needs to rephrase “minimal normal subgroup” slightly. I prefer the phrasing using minimal normal subgroups of quotient groups, also known as chief factors. Chief factors control a group “horizontally” by building the group in layers, and I highly recommend studying them.
Here a chief factor factor is a pair of normal subgroups $H < M$ of $G$ such that there is no normal subgroup $N$ with $H < N < M$; a chief factor is said to have a group theoretic property if the quotient $M/H$ has it, and it is said to have a subgroup theoretic property if $M/H$ has it in $G/H$. A finite group is supersolvable if and only if all of its chief factors are cyclic. A finite group is a $p$-group if and only if all of its chief factors are cyclic groups of order $p$. A finite group is solvable if and only if all of its chief factors are abelian. A group acts supersolvably on its normal subgroup $K$ if and only if every chief factor $H < M$ with $M \leq K$ is cyclic. The Fitting subgroup is the set of all elements that centralize every chief factor: $g \in G$ such that $[g,h] \in M$ for every $h \in H$.