Proposition: If $R$ is an integral domain and $x\in R\setminus \{0\}$, then $x$ is irreducible if and only if $xR$ is maximal amongst all principal proper ideals of $R$ (ie if $I=yR \subsetneq R$ and $xR\subseteq yR$ then $xR=yR$).
Proof: ($\Rightarrow$) Suppose $x$ is irreducible and choose $y\in R$ with $xR\subseteq yR\subsetneq R$. Then, for some $r\in R$, $x=yr$. Since $x$ is irreducible, either $y\in U(R)$ or $r\in U(R)$. However, the fact that $yR\neq R$ implies that $y\notin U(R)$, hence $r\in U(R)$, $y=r^{-1}x$, and it easily follows that $xR=yR$. Hence, $xR$ is maximal amongst proper principal ideals of $R$.
($\Leftarrow$) Suppose that $xR$ is maximal amongst all principal proper ideals of $R$, and assume that $x=yz$ for nonzero nonunits $y,z\in R$. Then, since neither $y$ nor $z$ are units, it is clear that $xR=yzR\subsetneq yR\subsetneq R$. This contradicts the maximality of $xR$ amongst proper principal ideals of $R$. Therefore $x$ is irreducible. $\blacksquare$
Now, if $R$ is a PID, then the above proposition implies that for all irredicuble $x\in R$, $xR$ is a maximal ideal.
My question is actually the same as Goblin Gone's comment underneath: Do we really need $R$ is an integral domain condition to do the above proof?