The classical problem of suppressing vortex shedding in the wake of a circular cylinder by using body rotation is revisited in an adjoint-based optimal control framework. The cylinder's unsteady and fully unconstrained rotation rate is optimized at Reynolds numbers between 75 and 200 and over horizons that are longer than in previous studies, where they are typically of the order of a vortex shedding period or shorter. In the best configuration, the drag is reduced by 19%, the vortex shedding is effectively suppressed, and this low drag state is maintained with minimal cylinder rotation after transients. Unlike open-loop control, the optimal control is shown to maintain a specific phase relationship between the actuation and the shedding in order to stabilize the wake. A comparison is also given between the performance of optimizations for different Reynolds numbers, cost functions, and horizon lengths. It is shown that the long horizons used are necessary in order to stabilize the vortex shedding efficiently.