The Nash-Kuiper theorem says that for $C^1$ isometric embeddings, $r$ just needs to be $n+1$, so in what follows smooth means $C^2$ or better.

These results are all in chapter 1 of Han and Hong's book "Isometric Embedding of Riemannian Manifolds in Euclidean Spaces," which is a great source for these sorts of results.

Let $s_n=\binom{n+1}{2}=\frac{n(n+1)}{2}$.

Theorem 1.1.6 (Janet-Cartan) states:

Any $n$-dimensional analytic Riemannian manifold admits a local analytic isometric embedding in $\mathbb{R}^{s_n}$.

This is proved using the Cauchy-Kowalevski theorem for analytic solutions of PDE in section 1.1.

Note that this is in some sense best possible since $s_n$ is the number of equations in the system $\sum_{k=1}^q\partial_i u^k\partial_j u^k = g_{ij}$ where $g_{ij}$ are the components of the metric on $M^n$ in some local coordinate system and $u:M^n\rightarrow\mathbb{R}^q$ is the embedding.

Theorem 1.2.4 (Gromov and Rokhlin, Greene) implies:

Any smooth $n$-dimensional Riemannian manifold admits a smooth local isometric embedding in $\mathbb{R}^{s_n+n}$.

It seems that it is an open question whether $r$ can be reduced to $s_n$ for smooth local isometric embeddings. In the notes to chapter 1 of their book, Han and Hong state that this is open even for $n=2$ and cite a 1982 list of problems by Yau.

Note that for some $n$, there are better results; e.g. when $n=2$, $r$ may be taken to be 4.