Use induction on $d=\dim R$.
If $d=0$, then $\text{inj}\dim M=0$, so $M$ is injective. Take a short exact sequence $0\longrightarrow N\longrightarrow F\longrightarrow M\longrightarrow 0$ with $F$ free of finite rank, notice that $F$ is injective and then $\text{inj}\dim N<\infty$. Furthermore, $\text{inj}\dim N=0$ and then the short exact sequence is split. It follows that $M$ is projective.
If $d>0$, then choose $x\in m$ ($m$ is the maximal ideal of $R$) which is nonzerodivisor on $R$ and on $N$, where $N$ (in this case) is the $d$th syzygy of $M$. (One can do this, since from B&H, exercise 2.1.26, one knows that $N$ is $0$ or maximal CM, so $m$ cannot be contained in the set of zerodivisors of $N$, otherwise $\text{depth } N=0$ which implies $d=0$, contradiction.) Notice again that $\text{inj}\dim N<\infty$ and now specialize all by $x$ and apply the induction hypothesis.