Let $f:N_1\to N_2$ be a homotopy equivalence between two simply connected manifolds with boundary of the same dimension. Can it be extended to a homotopy equivalence between closed manifolds $f:M_1\to M_2$ such that $N_i\subset M_i$? (I suppose there are counterexamples, but what I am actually interested in are the obstacles.)

The answer in general is no. Let $N_1$ be $S^2\times D^2$, and $N_2$ be the disk bundle of Euler class $1$ over $S^2$. Then both are homotopy equivalent to $S^2$. But no homotopy equivalence will extend to closed manifolds. For if $f: M_1 \to M_2$ is a homotopy equivalence, with $N_i \subset M_i$, then $N_i$ carry homology classes $a_i \in H_2(M_i)$ with $f_*(a_1) = a_2$. But $a_1 \cdot a_1 =0$ and $a_2 \cdot a_2 =1$ so there can't be such a homotopy equivalence, by homotopy invariance of the intersection form. (This would also work for non-orientable extensions, using the mod $2$ intersection form.)

I don't know a complete answer to your question of `what are the obstacles', but I guess you could say that the intersection form is one such obstacle. The point is that the intersection form is not a homotopy invariant for manifolds with boundary, but it is on closed manifolds, since it's Poincare dual to cup product, which is homotopy invariant. If your homotopy equivalence maps $\partial N_1$ to $\partial N_2$ and is also a homotopy equivalence of pairs, then you could just double the $N_i$ to get a homotopy equivalence. So the best general principle might be: ask how the given $f$ interacts with the boundary.

Tangent Stiefel-Whitney classes provide some obstructions. If $\bar f:M_1\to M_2$ is a homotopy equivalence, then $\bar f^\ast w_j(M_2)=w_j(M_1)$, and if $\bar f$ extends a map $f:N_1\to N_2$ where $N_i$ is a codimension zero submanifold of $N_i$ then it follows that $f^\ast w_j(N_2)=w_j(N_1)$.

Poincare duality gives another obstruction (EDIT: I now see that Danny Ruberman has made essentially the same observation while I was writing.). Choosing an orientation for $N$ you get a map $D_N:H_p(N)\cong H^{n-p}_c(N)\to H^{n-p}(N)$. If an extension $\bar f$ exists (and is a homotopy equivalence) then $f^\ast\circ D_{N_2}\circ f_\ast$ must be plus or minus $D_{N_1}$.