Let $CW$ be the category of CW complexes and $CW_{cof}$ be the wide subcategory whose objects are CW complexes and morphisms given by inclusions of subcomplexes (i.e. cofibrations in the model category structure on topological spaces). Let h be the class of these morphisms which are also homotopy equivalences (their inverse will not be a cofibration in general). I would like to know whether the localizations of these two categories along $h$ agree, i.e. whether $CW[h^{-1}]$ is equivalent to $CW_{cof}[h^{-1}]$. Admittedly, I am being ambiguous about what the resulting localizing categories are.
My thinking is that this should be true since for any map $f: X \rightarrow Y$, there is a homotopy commutative diagram involving $i: X \rightarrow Cyl(f)$ and $j: Y → Cyl(f)$, where $Cyl(f)$ is the mapping cylinder of $f$ and $i,j$ are both cofibrations and $j$ is a homotopy equivalence. Would an argument like this answer the above question affirmatively?
Is there a more general claim for arbitrary model categories?
It is true in quite some generality. Your argument is good enough to prove that the comparison functor is full, but I do not know how to prove that the comparison functor is faithful without using an explicit construction of the two localised categories as in the proof I present below. For various reasons I prefer thinking about fibrations so I will discuss the dual situation.
Theorem. If $\mathcal{E}$ is a category of fibrant objects (in the sense of Brown) and $\mathcal{E}_\mathrm{fib}$ is the wide subcategory of fibrations in $\mathcal{E}$, then the induced functor $\operatorname{Ho} \mathcal{E}_\textrm{fib} \to \operatorname{Ho} \mathcal{E}$ is an isomorphism of categories.
Remark. The full subcategory of fibrant objects in a model category is indeed a category of fibrant objects (in the sense of Brown).
Proof of theorem. For objects $X$ and $Y$ in $\mathcal{E}$, let $\mathcal{E}^\textrm{fun}_\textrm{fib} (X, Y)$ be the following category:
An object is a pair $(F, p)$ where $F$ is an object in $\mathcal{E}$ and $p : F \to Y \times X$ is a fibration in $\mathcal{E}$ such that the composite $F \to Y \times X \to X$ is a trivial fibration in $\mathcal{E}$.
A morphism $(F_0, p_0) \to (F_1, p_1)$ is a fibration $h : F_0 \to F_1$ in $\mathcal{E}$ such that $p_1 \circ h = p_0$.
Composition and identities are inherited from $\mathcal{E}$.
There is a composition functor $\mathcal{E}^\textrm{fun}_\textrm{fib} (Y, Z) \times \mathcal{E}^\textrm{fun}_\textrm{fib} (X, Y) \to \mathcal{E}^\textrm{fun}_\textrm{fib} (X, Z)$: given an object $(G, q)$ in $\mathcal{E}^\textrm{fun}_\textrm{fib} (Y, Z)$ and an object $(F, p)$ in $\mathcal{E}^\textrm{fun}_\textrm{fib} (X, Y)$, we may form the following pullback square in $\mathcal{E}$: $$\require{AMScd} \begin{CD} G \circ F @>>> G \times F \\ @VVV @VV{q \times p}V \\ Z \times Y \times X @>>{\textrm{id}_Z \times \Delta_Y \times \textrm{id}_X}> Z \times Y \times Y \times X \end{CD}$$ Let $q * p : G \circ F \to Z \times X$ be the evident composite $G \circ F \to Z \times Y \times X \to Z \times X$. It is a fibration in $\mathcal{E}$. Furthermore, we also have the following pullback square in $\mathcal{E}$, $$\begin{CD} G \circ F @>{\simeq}>> F \\ @VVV @VVV \\ G @>>{\simeq}> Y \end{CD}$$ where $G \circ F \to G$ and $G \circ F \to F$ are the two components of the morphism $G \circ F \to G \times F$ appearing in the first pullback diagram, $G \to Y$ is the component of $q : G \to Z \times Y$, and $F \to Y$ is the component of $p : F \to Y \times X$. Hence, the composite $G \circ F \to Z \times X \to X$ is a trivial fibration in $\mathcal{E}$, so we indeed have an object $(G \circ F, q * p)$ in $\mathcal{E}^\textrm{fun}_\textrm{fib} (X, Z)$. The action of the functor on morphisms is defined by the pullback pasting lemma.
This composition operation is neither associative nor unital in the strict sense. It is associative up to isomorphism, and unital up to weak equivalence. (Any path object of $X$ is a weak identity for $X$.) At any rate, consider the following category $\bar{\mathcal{E}}$:
An object is an object in $\mathcal{E}$.
A morphism $X \to Y$ is a connected component of $\mathcal{E}^\textrm{fun}_\textrm{fib} (X, Y)$.
Composition is induced by the operation defined above, and the identities are the connected components of weak identities.
There is an identity-on-objects functor $\mathcal{E} \to \bar{\mathcal{E}}$ that sends each morphism $f : X \to Y$ to the connected component of a mapping path object of $f$, i.e. the connected component in $\mathcal{E}^\textrm{fun}_\textrm{fib} (X, Y)$ of some $(F, p)$ defined by a pullback square in $\mathcal{E}$ of the form below, $$\begin{CD} F @>>> \textrm{Path} (Y) \\ @V{p}VV @VVV \\ Y \times X @>>{\textrm{id}_Y \times f}> Y \times Y \end{CD}$$ where $\textrm{Path} (Y) \to Y \times Y$ is the path fibration. It is straightforward to check that every trivial fibration in $\mathcal{E}$ is mapped to an isomorphism in $\bar{\mathcal{E}}$. Since every weak equivalence in $\mathcal{E}$ can be factored as a section of a trivial fibration followed by a trivial fibration, it follows that every weak equivalence in $\mathcal{E}$ is mapped to an isomorphism in $\bar{\mathcal{E}}$. It is also straightforward (but even more tedious) to see that any functor $\mathcal{E} \to \mathcal{C}$ that sends weak equivalences in $\mathcal{E}$ to isomorphisms in $\mathcal{C}$ admits a unique extension along $\mathcal{E} \to \bar{\mathcal{E}}$: in effect, an object $(F, p)$ in $\mathcal{E}^\textrm{fun}_\textrm{fib} (X, Y)$ represents the composite of the inverse of the trivial fibration $F \to X$ followed by the fibration $F \to Y$. Hence, $\bar{\mathcal{E}}$ is isomorphic to $\operatorname{Ho} \mathcal{E}$ (as categories under $\mathcal{E}$).
We can restrict the functor $\mathcal{E} \to \bar{\mathcal{E}}$ to the subcategory $\mathcal{E}_\textrm{fib}$ and apply the same arguments (mutatis mutandis) to find that $\bar{\mathcal{E}}$ is isomorphic to $\operatorname{Ho} \mathcal{E}_\textrm{fib}$ (as categories under $\mathcal{E}_\textrm{fib}$). Thus the comparison functor $\operatorname{Ho} \mathcal{E}_\textrm{fib} \to \operatorname{Ho} \mathcal{E}$ is also an isomorphism. ◼
Remark. If we only wanted to have an explicit construction of $\operatorname{Ho} \mathcal{E}$, then instead of the category $\mathcal{E}^\textrm{fun}_\textrm{fib} (X, Y)$ defined in the proof we could substitute the category $\mathcal{E}^\textrm{fun} (X, Y)$, which has the same objects but allows non-fibrations as morphisms between objects. The fact that $\mathcal{E}^\textrm{fun}_\textrm{fib} (X, Y) \hookrightarrow \mathcal{E}^\textrm{fun} (X, Y)$ is a bijection on connected components is, in some sense, a consequence of this theorem applied to the category $(\mathcal{E}_{Y \times X})_\mathrm{f}$ of fibrations over $Y \times X$, which is itself a category of fibrant objects.
I have not checked carefully, but I think iterating this kind of analysis proves that $\mathcal{E}^\textrm{fun}_\textrm{fib} (X, Y) \hookrightarrow \mathcal{E}^\textrm{fun} (X, Y)$ is a weak homotopy equivalence and that the $(\infty, 1)$-categorical localisations of $\mathcal{E}_\textrm{fib}$ and $\mathcal{E}$ also coincide.