Perturb a given smooth function to a Morse function relative to fixed level sets, which are already fine. Let $M$ be a manifold (not necessarily compact) , for the sake of clearness embedded in $\mathbb{R^n}$ and $f\colon M\rightarrow \mathbb{R}$ a smooth function.
The theorem of Sard gives us that $$f+\langle\ \cdot\ ,a\rangle \colon M\rightarrow \mathbb{R}, \ x\mapsto f(x)+a_1x_1+...+a_nx_n$$ is a Morse function for almost all $a\in\mathbb{R}^n$.
Now suppose I have a finite set of regular values $c_1,...,c_n$ of $f$, so $f^{-1}(c_1),...,f^{-1}(c_n)$ do not contain critical points. Can I deform $f$ slightly to $\tilde f$, such that it becomes a Morse function, but the level sets of $c_1,..,c_n$ remain unchanged, i.e. $f^{-1}(c_i)=\tilde f^{-1}(c_i)$?
This is somehow a relative version of the density of Morse functions in the space of smooth functions.
 A: Here's a partial answer:
Since the union of the regular level sets $f^{-1}(c_i)$ and the set of all critical points are disjoint closed sets, they are contained in open neighborhoods $U$ and $V$, respectively, whose closures are disjoint.  Using the (smooth) Urysohn lemma, we can find a smooth function $\rho: M \to \mathbb{R}$ which satisfies $\rho|_{\bar V} =1$ but vanishes on $\bar U$. Then $\tilde f=f+\rho \langle \cdot, a\rangle$ restricts to $f$ on $\bar U$ (hence on the level sets $f^{-1}(c_i)$)  and $f+\langle \cdot,a\rangle$ on $\bar V$ (hence near all critical points of $f$), as desired. This leaves two final conditions to verify:


*

*Show that $\tilde f$ has no nondegenerate critical points in $M \setminus (U \cup V)$. In particular, if we can make sure that there are no critical points in $M \setminus (U \cup V)$, then $\tilde f$ will be Morse. 

*Show that no new points wound up in the level sets $f^{-1}(c_i)$ --- that is, show that there are no points $x$ outside of $U$ such that $\tilde f(x)=c_i$ for some $i$. 
I have an argument below that should work whenever $M \setminus (U \cup V)$ is compact, but this isn't always possible if $M$ isn't compact. (Consider a cylinder along the $x$-axis in $\mathbb{R}^3$, where $f$ is the $z$-coordinate projection and $c=0$.)  I think the second step should be relatively straightforward, but I haven't thought through it fully. 
Claim.  If we can choose $U$ and $V$ such that $M \setminus (U \cup V)$ is compact, then we can choose $a \in \mathbb{R}^n$ such that  $\tilde f$ has no critical points in $M \setminus (U \cup V)$. (In particular, this is possible if $M$ is compact or, more generally, if the set of critical points of $f$ or each of the level sets $f^{-1}(c_i)$ is compact.)
Proof. For convenience, embed $M$ into $\mathbb{R}^n$ such that the final coordinate is given by $f$. Let $X_f$ be the gradient vector field on $M$ defined via the inner product  inherited from $\mathbb{R}^n$. Then $X_f(x)$ is just the projection of $(0,\ldots,0,1) \in \mathbb{R}^n$ onto $T_x M \subset T_x \mathbb{R}^n \cong \mathbb{R}^n$. Consider the function $df(X_f): M \to \mathbb{R}$ given by $$x \mapsto df_x(X_f(x))=\langle X_f(x),X_f(x)\rangle=\| X_f(x)\|^2.$$
This function vanishes precisely when $X_f$ vanishes, i.e. on the set of critical points of $f$. Therefore $df (X_f)$ is strictly positive on $M \setminus (U \cup V)$.  If we can choose $U,V$ such that $M \setminus (U \cup V)$ is compact, then $df(X_f)$ is bounded below by some $\epsilon>0$ on $M \setminus (U \cup V)$. It follows that
\begin{equation*} d\tilde f_x(X_f(x))> \epsilon + \rho(x) \langle X_f(x),a\rangle +\langle x,a\rangle d\rho_x(X_f(x)). \end{equation*}
Using compactness again, we can find some $\delta >0$ such that
$$\big|\rho(x) \langle X_f(x),a\rangle + \langle x,a\rangle d \rho_x(X_f(x))\big|<\delta$$
for $x \in M\setminus (U \cup V)$. Since the above function scales linearly when we replace $a$ with a (positive) scalar multiple of itself, we can make the bound $\delta$ arbitrarily small. In particular, choose $a$ small enough to ensure $\delta<\epsilon$. Then we have
\begin{align*} d\tilde f_x(X_f(x))&> \epsilon + \rho(x) \langle X_f(x),a\rangle +\langle x,a\rangle d\rho_x(X_f(x))\\
& \geq \epsilon-\big|\rho(x) \langle X_f(x),a\rangle +\langle x,a\rangle d\rho_x(X_f(x))\big| \\
&> \epsilon - \delta \\
&>0 . \end{align*}
(After making $a$ sufficiently small, we can perturb it slightly again to make sure that $\tilde f$ is still Morse on $V$.) It follows that $\tilde f$ has no critical points in $M \setminus (U \cup V)$.
