A superconducting single-electron transistor (SSET) coupled to an anharmonic oscillator, e.g., a Josephson junction-L-C circuit, can drive the latter to a nonequilibrium photon number state. By biasing the SSET in a regime where the current is carried by a combination of inelastic quasiparticle tunneling and coherent Cooper-pair tunneling (Josephson quasiparticle cycle), cooling of the oscillator as well as a laser like enhancement of the photon number can be achieved. Here we show, that the cut-off in the quasiparticle tunneling rate due to the superconducting gap, in combination with the anharmonicity of the oscillator, may create strongly squeezed photon number distributions. For low dissipation in the oscillator nearly pure Fock states can be produced.