Microbubbles are used as contrast agents because they scatter incident ultrasound (US) efficiently. Pulse-inversion imaging makes use of the asymmetrical difference in response of a bubble to an US pulse and its symmetrical opposite to obtain improved contrast. In this theoretical work, the principle of pulse-inversion imaging is expanded upon by finding the optimal pulse shape to maximize the signal from a bubble. Given a limit on driving intensity, a suitable norm of the bubble response is maximized using optimal control theory to identify the proper pulse/antipulse driving protocol for a single bubble. The optimal pulse yields a several-fold increase in the normed response over the best sinusoidal pulse of the same driving intensity. It was found that the optimal driving for a single bubble also maximizes the nonlinear response of the cloud if its mean bubble size is the same as that of the single bubble.