In this paper we study the existence and linear stability of almost periodic solutions for a NLS equation on the circle with external parameters. Starting from the seminal result of Bourgain in [15] on the quintic NLS, we propose a novel approach allowing to prove in a unified framework the persistence of finite and infinite dimensional invariant tori, which are the support of the desired solutions. The persistence result is given through a rather abstract "counter-term theorem" à la Herman, directly in the original elliptic variables without passing to action-angle ones. Our framework allows us to find "many more" almost periodic solutions with respect to the existing literature and consider also non-translation invariant PDEs.