Please note that I am requesting a formal proof, using any technique.
There are two parts in the implication:
(i) if $p$ is a prime, then $p^3\mid y^2\implies p\mid y^2$,
(ii) if $p$ is a prime, then $p\mid y^2 \implies p\mid y$.
I know that, as by the post asked by me : if $p$ is a prime, and $p\mid a^k$ for any natural number $a,k$, then $p\mid a$, but the first part is not obvious from this.
Partial Hint
It can be shown that if $p^m | a^2$, then $p^{\lceil m/2 \rceil} | a$. Your consideration here, is the case where $m=1$.
Edit (Sketch proof)
Let \begin{align} n &= \prod p_i^{n_i} \\ m &= \prod p_i^{m_i}\\ a &=\prod p_i^{a_i} \end{align} Then $n | a^2$ means that $n_i \le 2a_i$ or $a_i\ge \lceil \frac{n_i}{2} \rceil$. On the other hand $m | a$ means that $m_i \le a_i$.
If $m$ is as large as possible, $m_i = a_i$ so $m_i = \lceil \frac{n_i}{2} \rceil $.