Nonlinear optical frequency conversion, in which optical fields interact with a nonlinear medium to produce new field frequencies, is ubiquitous in modern photonic systems. However, the nonlinear electric susceptibilities that give rise to such phenomena are often challenging to tune in a given material and, so far, dynamical control of optical nonlinearities remains confined to research laboratories as a spectroscopic tool. Here, we report a mechanism to electrically control second-order optical nonlinearities in monolayer WSe₂, an atomically thin semiconductor. We show that the intensity of second-harmonic generation at the A-exciton resonance is tunable by over an order of magnitude at low temperature and nearly a factor of four at room temperature through electrostatic doping in a field-effect transistor. Such tunability arises from the strong exciton charging effects in monolayer semiconductors, which allow for exceptional control over the oscillator strengths at the exciton and trion resonances. The exciton-enhanced second-harmonic generation is counter-circularly polarized to the excitation laser due to the combination of the two-photon and one-photon valley selection rules, which have opposite helicity in the monolayer. Our study paves the way towards a new platform for chip-scale, electrically tunable nonlinear optical devices based on two-dimensional semiconductors.