The design of gain-scheduled strictly positive real (SPR) controllers using numerical optimization is considered. Our motivation is robust, yet accurate motion control of flexible robotic systems via the passivity theorem. It is proven that a family of very strictly passive compensators scheduled via time- or state-dependent scheduling signals is also very strictly passive. Two optimization problems are posed; we first present a simple method to optimize the linear SPR controllers, which compose the gain-scheduled controller. Second, we formulate the optimization problem associated with the gain-scheduled controller itself. Restricting our investigation to time-dependent scheduling signals, the signals are parameterized, and the optimization objective function seeks to find the form of the scheduling signals, which minimizes a combination of the manipulator tip tracking error and the control effort. A numerical example employing a two-link flexible manipulator is used to demonstrate the effectiveness of the optimal gain-scheduling algorithm. The closed-loop system performance is improved, and it is shown that the optimal scheduling signals are not necessarily linear.