Well, the question is more or less completely contained in the title. I found a partially related question on MO, namely this, and googling around reveals an amazing theorem of Browder, Levine, and Livesay, which gives sufficient conditions for simply connected manifolds of high enough dimension to be homotopy equivalent to a compact manifold (actually necessary and sufficient to be an interior of a compact manifold with boundary).
However, I am not concerned with the desired compact space being a manifold or otherwise not pathological, and wouldn't mind putting additional restrictions on the original space (like having finitely many connected components or finitely generated homology).
I would appreciate any help.
UPD: edited the question just to bring it to the front page again.