Let $x \in X$. It suffices to find an open neighbourhood $U$ of $x$ such that $M$ restricts to a perfect complex over $U$. Hence during the proof we can (finitely often) replace $X$ by an open neighbourhood of $x$. Let $N, \eta, \epsilon$ be a left dual. \medskip\noindent We are going to use the following argument several times. Choose any complex $\mathcal{M}^\bullet$ of $\mathcal{O}_X$-modules representing $M$. Choose a K-flat complex $\mathcal{N}^\bullet$ representing $N$ whose terms are flat $\mathcal{O}_X$-modules, see Lemma \ref{lemma-K-flat-resolution}. Consider the map $$ \eta : \mathcal{O}_X \to \text{Tot}(\mathcal{M}^\bullet \otimes_{\mathcal{O}_X} \mathcal{N}^\bullet) $$ After shrinking $X$ we can find an integer $N$ and for $i = 1, \ldots, N$ integers $n_i \in \mathbf{Z}$ and sections $f_i$ and $g_i$ of $\mathcal{M}^{n_i}$ and $\mathcal{N}^{-n_i}$ such that $$ \eta(1) = \sum\nolimits_i f_i \otimes g_i $$ Let $\mathcal{K}^\bullet \subset \mathcal{M}^\bullet$ be any subcomplex of $\mathcal{O}_X$-modules containing the sections $f_i$ for $i = 1, \ldots, N$. Since $\text{Tot}(\mathcal{K}^\bullet \otimes_{\mathcal{O}_X} \mathcal{N}^\bullet) \subset \text{Tot}(\mathcal{M}^\bullet \otimes_{\mathcal{O}_X} \mathcal{N}^\bullet)$ by flatness of the modules $\mathcal{N}^n$, we see that $\eta$ factors through $$ \tilde \eta : \mathcal{O}_X \to \text{Tot}(\mathcal{K}^\bullet \otimes_{\mathcal{O}_X} \mathcal{N}^\bullet) $$ Denoting $K$ the object of $D(\mathcal{O}_X)$ represented by $\mathcal{K}^\bullet$ we find a commutative diagram $$ \xymatrix{ M \ar[rr]_-{\eta \otimes 1} \ar[rrd]_{\tilde \eta \otimes 1} & & M \otimes^\mathbf{L} N \otimes^\mathbf{L} M \ar[r]_-{1 \otimes \epsilon} & M \\ & & K \otimes^\mathbf{L} N \otimes^\mathbf{L} M \ar[u] \ar[r]^-{1 \otimes \epsilon} & K \ar[u] } $$ Since the composition of the upper row is the identity on $M$ we conclude that $M$ is a direct summand of $K$ in $D(\mathcal{O}_X)$. \medskip\noindent As a first use of the argument above, we can choose the subcomplex $\mathcal{K}^\bullet = \sigma_{\geq a} \tau_{\leq b}\mathcal{M}^\bullet$ with $a < n_i < b$ for $i = 1, \ldots, N$. Thus $M$ is a direct summand in $D(\mathcal{O}_X)$ of a bounded complex and we conclude we may assume $M$ is in $D^b(\mathcal{O}_X)$. (Recall that the process above involves shrinking $X$.) \medskip\noindent Since $M$ is in $D^b(\mathcal{O}_X)$ we may choose $\mathcal{M}^\bullet$ to be a bounded above complex of flat modules (by Modules, Lemma \ref{modules-lemma-module-quotient-flat} and Derived Categories, Lemma \ref{derived-lemma-subcategory-left-resolution}). Then we can choose $\mathcal{K}^\bullet = \sigma_{\geq a}\mathcal{M}^\bullet$ with $a < n_i$ for $i = 1, \ldots, N$ in the argument above. Thus we find that we may assume $M$ is a direct summand in $D(\mathcal{O}_X)$ of a bounded complex of flat modules. In particular,  $M$ has finite tor amplitude. \medskip\noindent Say $M$ has tor amplitude in $[a, b]$. Assuming $M$ is $m$-pseudo-coherent we are going to show that (after shrinking $X$) we may assume $M$ is $(m - 1)$-pseudo-coherent. This will finish the proof by Lemma \ref{lemma-perfect-precise} and the fact that $M$ is $(b + 1)$-pseudo-coherent in any case. After shrinking $X$ we may assume there exists a strictly perfect complex $\mathcal{E}^\bullet$ and a map $\alpha : \mathcal{E}^\bullet \to M$ in $D(\mathcal{O}_X)$ such that $H^i(\alpha)$ is an isomorphism for $i > m$ and surjective for $i = m$. We may and do assume that $\mathcal{E}^i = 0$ for $i < m$. Choose a distinguished triangle $$ \mathcal{E}^\bullet \to M \to L \to \mathcal{E}^\bullet[1] $$ Observe that $H^i(L) = 0$ for $i \geq m$. Thus we may represent $L$ by a complex $\mathcal{L}^\bullet$ with $\mathcal{L}^i = 0$ for $i \geq m$. The map $L \to \mathcal{E}^\bullet[1]$ is given by a map of complexes $\mathcal{L}^\bullet \to \mathcal{E}^\bullet[1]$ which is zero in all degrees except in degree $m - 1$ where we obtain a map $\mathcal{L}^{m - 1} \to \mathcal{E}^m$, see Derived Categories, Lemma \ref{derived-lemma-negative-exts}. Then $M$ is represented by the complex $$ \mathcal{M}^\bullet : \ldots \to \mathcal{L}^{m - 2} \to \mathcal{L}^{m - 1} \to \mathcal{E}^m \to \mathcal{E}^{m + 1} \to \ldots $$ Apply the discussion in the second paragraph to this complex to get sections $f_i$ of $\mathcal{M}^{n_i}$ for $i = 1, \ldots, N$. For $n < m$ let $\mathcal{K}^n \subset \mathcal{L}^n$ be the $\mathcal{O}_X$-submodule generated by the sections $f_i$ for $n_i = n$ and $d(f_i)$ for $n_i = n - 1$. For $n \geq m$ set $\mathcal{K}^n = \mathcal{E}^n$. Clearly, we have a morphism of distinguished triangles $$ \xymatrix{ \mathcal{E}^\bullet \ar[r] & \mathcal{M}^\bullet \ar[r] & \mathcal{L}^\bullet \ar[r] & \mathcal{E}^\bullet[1] \\ \mathcal{E}^\bullet \ar[r] \ar[u] & \mathcal{K}^\bullet \ar[r] \ar[u] & \sigma_{\leq m - 1}\mathcal{K}^\bullet \ar[r] \ar[u] & \mathcal{E}^\bullet[1] \ar[u] } $$ where all the morphisms are as indicated above. Denote $K$ the object of $D(\mathcal{O}_X)$ corresponding to the complex $\mathcal{K}^\bullet$. By the arguments in the second paragraph of the proof we obtain a morphism $s : M \to K$ in $D(\mathcal{O}_X)$ such that the composition $M \to K \to M$ is the identity on $M$. We don't know that the diagram $$ \xymatrix{ \mathcal{E}^\bullet \ar[r] & \mathcal{K}^\bullet \ar@{=}[r] & K \\ \mathcal{E}^\bullet \ar[u]^{\text{id}} \ar[r]^i & \mathcal{M}^\bullet \ar@{=}[r] & M \ar[u]_s } $$ commutes, but we do know it commutes after composing with the map $K \to M$. By Lemma \ref{lemma-local-actual} after shrinking $X$ we may assume that $s \circ i$ is given by a map of complexes $\sigma : \mathcal{E}^\bullet \to \mathcal{K}^\bullet$. By the same lemma we may assume the composition of $\sigma$ with the inclusion $\mathcal{K}^\bullet \subset \mathcal{M}^\bullet$ is homotopic to zero by some homotopy $\{h^i : \mathcal{E}^i \to \mathcal{M}^{i - 1}\}$. Thus, after replacing $\mathcal{K}^{m - 1}$ by $\mathcal{K}^{m - 1} + \Im(h^m)$ (note that after doing this it is still the case that $\mathcal{K}^{m - 1}$ is generated by finitely many global sections), we see that $\sigma$ itself is homotopic to zero! This means that we have a commutative solid diagram $$ \xymatrix{ \mathcal{E}^\bullet \ar[r] & M \ar[r] & \mathcal{L}^\bullet \ar[r] & \mathcal{E}^\bullet[1] \\ \mathcal{E}^\bullet \ar[r] \ar[u] & K \ar[r] \ar[u] & \sigma_{\leq m - 1}\mathcal{K}^\bullet \ar[r] \ar[u] & \mathcal{E}^\bullet[1] \ar[u] \\ \mathcal{E}^\bullet \ar[r] \ar[u] & M \ar[r] \ar[u]^s & \mathcal{L}^\bullet \ar[r] \ar@{..>}[u] & \mathcal{E}^\bullet[1] \ar[u] } $$ By the axioms of triangulated categories we obtain a dotted arrow fitting into the diagram. Looking at cohomology sheaves in degree $m - 1$ we see that we obtain $$ \xymatrix{ H^{m - 1}(M) \ar[r] & H^{m - 1}(\mathcal{L}^\bullet) \ar[r] & H^m(\mathcal{E}^\bullet) \\ H^{m - 1}(K) \ar[r] \ar[u] & H^{m - 1}(\sigma_{\leq m - 1}\mathcal{K}^\bullet) \ar[r] \ar[u] & H^m(\mathcal{E}^\bullet) \ar[u] \\ H^{m - 1}(M) \ar[r] \ar[u] & H^{m - 1}(\mathcal{L}^\bullet) \ar[r] \ar[u] & H^m(\mathcal{E}^\bullet) \ar[u] } $$ Since the vertical compositions are the identity in both the left and right column, we conclude the vertical composition $H^{m - 1}(\mathcal{L}^\bullet) \to H^{m - 1}(\sigma_{\leq m - 1}\mathcal{K}^\bullet) \to H^{m - 1}(\mathcal{L}^\bullet)$ in the middle is surjective! In particular $H^{m - 1}(\sigma_{\leq m - 1}\mathcal{K}^\bullet) \to H^{m - 1}(\mathcal{L}^\bullet)$ is surjective. Using the induced map of long exact sequences of cohomology sheaves from the morphism of triangles above, a diagram chase shows this implies $H^i(K) \to H^i(M)$ is an isomorphism for $i \geq m$ and surjective for $i = m - 1$. By construction we can choose an $r \geq 0$ and a surjection $\mathcal{O}_X^{\oplus r} \to \mathcal{K}^{m - 1}$. Then the composition $$ (\mathcal{O}_X^{\oplus r} \to \mathcal{E}^m \to \mathcal{E}^{m + 1} \to \ldots ) \longrightarrow K \longrightarrow M $$ induces an isomorphism on cohomology sheaves in degrees $\geq m$ and a surjection in degree $m - 1$ and the proof is complete.