In this paper, we deal with infinite horizon optimal control problems involving affine-linear dynamics and prove the existence of optimal solutions. The innovation of this paper lies in the special setting of the problem, precisely in the choice of weighted Sobolev and weighted Lebesgue spaces as the state and control spaces, respectively, which turns out to be meaningful for various problems. We apply the generalized Weierstraß theorem to prove the existence result. A lower semicontinuity theorem which is needed for that is shown under weakened assumptions.