In this paper, we address the problem of closed-loop control of nonlinear dynamical systems subjected to probabilistic uncertainties. More precisely, we design time-varying polynomial feedback controllers to follow the given nominal trajectory and also, for safety purposes, remain in the tube around the nominal trajectory, despite all uncertainties. We formulate this problem as a chance optimization problem where we maximize the probability of achieving control objectives. To address control problems with long planning horizons, we formulate the single large chance optimization problem as a sequence of smaller chance optimization problems. To solve the obtained chance optimization problems, we leverage the theory of measures and moments and obtain convex relaxations in the form of semidefinite programs. We provide numerical examples on stabilizing controller design and motion planning of uncertain nonlinear systems to illustrate the performance of the proposed approach.