We study the response of a magnetic-field-driven superconducting qubit strongly coupled to a superconducting coplanar waveguide resonator. We observed a strong amplification/damping of a probing signal at different resonance points corresponding to a one and two-photon emission/absorption. The sign of the detuning between the qubit frequency and the probe determines whether amplification or damping is observed. The larger blue detuned driving leads to two-photon lasing while the larger red detuning cools the resonator. Our experimental results are in good agreement with the theoretical model of qubit lasing and cooling at the Rabi frequency.