In this paper, we completely classify the finite $p$-groups $G$ such that $\Phi(G')G_3\le C_p^2$, $\Phi(G')G_3\le Z(G)$ and $G/\Phi(G')G_3$ is minimal non-abelian. This paper is a part of the classification of finite $p$-groups with a minimal non-abelian subgroup of index $p$. Together with other four papers, we solve a problem proposed by Y. Berkovich.