Is there any characterization for $p$groups of order greater than $p^3$ which center has index $p^2$? (One group whit this property if $M(p^n)$)

Let $G$ be a group in question. First note that $G/Z(G)\cong C_{p^2}$ isn't possible. Thus $G$ has the presentation $$\langle Z,x,y\mid Z \text{ central}, x^p=a,y^p=b,[x,y]=c\rangle$$ where $Z$ is the center, $a,b, c \in Z$ and $c\neq 1,\; c^p=1$. Added: Suppose $a=a_0^p,a_0 \in Z$. By replacing $x$ by $xa_0^{1}$ we have the relation $x^p = 1$. Write $Z=\langle z_1,...,z_n\mid r(Z)\rangle$. Then we obtain the presentations $$\tag{I}G(c)=\langle z_1,...,z_n,x,y\mid r(Z), x^p=y^p=1,[x,y]=c\rangle$$ $$G(c,i)= \langle z_1,...,z_n,x,y\mid r(Z), x^p=z_i, y^p=1,[x,y]=c\rangle\tag{II}$$ $$G(c,i,j)=\langle z_1,...,z_n,x,y\mid r(Z), x^p=z_i,y^p=z_j,[x,y]=c\rangle\tag{III}$$ Added 2: 1) In case (III) we can assume $i\neq j$ (otherwise, replacing $x$ by $xy^{1}$ gives case (II)). 2) Let $\exp(z_i)=k_i$. Denote by $(k_1,...,k_n)$ the isomorphism type of $C_{p^{k_1}} \times \cdots C_{p^{k_n}}$. Then the groups above have maximal abelian subgroups of the following types: $$\begin{array}{lcl} (I) & : & (k_1,...,k_n,1) \newline (II) & : & (k_1,...,k_n,1), (k_1,..,k_i+1,..,k_n) \newline (III) & : & (k_1,..,k_i+1,..,k_n), (k_1,..,k_j+1,..,k_n) \end{array}$$ Hence (I), (II), (III) belong to different ismorphism types. It remains to check for which parameters $c,i,j$ the groups within (I) resp. (II) resp. (III) are isomorphic. Added 3: Modulo possible mistakes a complete classification is given by: Let $p$ be an odd prime, $Z=\langle z_1,...,z_n\rangle \cong C_{p^{l_1}}^{n_1} \times \cdots \times C_{p^{l_m}}^{n_m}$ with $l_1 > \cdots > l_m$ and suppose $$\lbrace 1,...,n\rbrace = \coprod_{i=1}^m \lbrace r_i,...,r_{i+1}1\rbrace\qquad (n_i=r_{i+1}r_i)$$ is a decomposition such that $\exp(z_j)=l_i$ for $r_i \le j < r_{i+1}$. Then the groups $G$ with $Z(G)=Z$ and $(G:Z(G))=p^2$ are given (up to isomorphism) by the following nonisomorphic presentations $(c_i := z_{r_i}^{p^{l_i1}}):$ $$\begin{array}{llcl} G(c_i) & (i=1,...,m) & \qquad & \text{(I)} \newline G(c_i,r_j) & (i,j=1,...,m) & \qquad & \text{(II)} \newline G(c_i,r_j,r_j+1) & (i,j=1,...,m,\;n_j \ge 2) & \qquad & \text{(IIIa)} \newline G(c_i,r_j,r_k) & (i,j,k=1,...,m,\;j \neq k) & \qquad & \text{(IIIb)} \end{array}$$ In particular, there are $m^3 +m(1 + \lbrace n_j \ge 2\rbrace)$ isomorphism classes. Proof: i) It follows from the structure of the max. abelian subgroups in Add2, that $G(c,i) \cong G(c,j)$ iff $k_i=k_j$ and $G(c,i,j)\cong G(c,l,q),\;(i\le j,\;l \le q)$ iff $k_i = k_l$ and $k_j=k_q$. ii) We determine the isomorphism types for various $c$. Claim 1: $\quad G(c,) \cong G(c',)$ iff there is $f \in Aut(Z)$ such that $c'=f(c)$. First, $f \in Aut(Z)$ extends to an isomorphism $\varphi_f: G(c,) \to G(f(c),)$ by $x \mapsto x, y\mapsto y$. Conversely, if $\varphi: G(c,) \to G(c',)$ is an isomorphism, then (easy calculation) there is $q$ coprime to $p$ with $c'=\varphi(c)^q$. Hence $c'=f(c)$ where $f\in Aut(Z)$ is the composition of $\varphiZ$ and the $q$power map. $\square$ Using $Z=\prod_{j=1}^m C_{p^{l_j}}^{n_j}$, we have the decomposition $\langle c\in Z \mid c^p=1\rangle = \coprod_{i=1}^m M_i$, where $$M_i = \lbrace (g_1,...,g_i,1,...,1)\mid g_i \neq 1,\;g_j \in C_{p^{l_j}}^{n_j},\; g_j^p=1\;(j=1,...,i)\;\rangle.$$ Claim 2: $\quad f(M_i)=M_i$ for $f \in Aut(Z)$. Conversely, for $c, c' \in M_i$ there is $f \in Aut(Z)$ such that $f(c)=c'$. I omit the proof which is in essential based on linear algebra. Since $c_i = z_{r_i}^{p^{l_i1}} \in M_i$, the claim implies $G(c,)\cong G(c_i,)$ for all $c \in M_i$ and $G(c_i,) \not\cong G(c_j,)$ for $i\neq j$. This completes the classification. Remark: For $p=2$ (in contrast to $p$ odd) we have in addition the case $G(c,i,i)$ (i.e. $x^2=y^2=c\neq 1$). Example: Quaternion group of order 8. The reason is that $(xy^{1})^p=c^{p(p+1)/2}$ is $1$ only if $p$ is odd. 


This is much less informative than Ralph's excellent answer, but a quick observation is that, for $p\gt 2$, the groups you are looking for are exactly the groups that are isoclinic to the nonabelian groups of order $p^3$. This observation was made by Philip Hall in The classification of primepower groups, J. Reine Angew. Math. 182 (1940) 130141; the observation can be found at the bottom of 136. Recall that two groups $G$ an $K$ are isoclinic if and only if:
The central quotient of your groups are of order $p^2$, and since a nontrivial cyclic group cannot be isomorphic to a central quotient, the central quotient is isomorphic to $C_p\times C_p$; the commutator subgroup is contained in the center, and so the group is of class $2$. Since there is a bilinear alternating map from $(G/Z(G))\times (G/Z(G))$ onto $[G,G]$. Added: in general, the map $(G/Z(G))\times (G/Z(G))\to[G,G]$ given by $(xZ(G),yZ(G))\mapsto [x,y]$ has image that generates $[G,G]$; in this case, since $G$ is of class $2$, the map is bilinear; if $G/Z(G)$ is generated by $x$ and $y$, then it follows that $[G,G]$ is generated by $[x,x]$, $[x,y]$, $[y,x]$, and $[y,y]$; the first and last are trivial, and third equals the inverse of the second, so $[G,G]$ is cyclic generated by $[x,y]$. It now follows that the map is in fact onto. Since $G/Z(G)$ is of exponent $p$, then so is $[G,G]$ by the bilinearity of the bracket. Since $G$ is nonabelian, it follows that $[G,G]$ is cyclic of order $p$. It is now straightforward to see that a group with center of index $p^2$ is necessarily isoclinic to the nonabelian groups of order $p^3$. Conversely, if $G$ is isoclinic to the nonabelian groups of order $p^3$, then their central quotients must be of order $p^2$, giving the equivalence. An alternative description in the case of $p$groups, also given by Hall, is that they are precisely the nonabelian $p$groups that have at least two abelian subgroups of index $p$. 


See two my comments above containing solution of the problem. I repeat: A nonabelian $p$group $G$ has the center of index $p^2$ if and only if $G=S\text{Z}(G)$, where $S\le G$ is minimal nonabelian. 

