Two-state lasing in devices based on undoped and p-type modulation-doped InAs/InGaAs quantum dots is studied for various cavity lengths and temperatures. Modulation doping of the active region strongly enhances the threshold current of two-state lasing, preserves ground-state lasing up to higher temperatures and increases ground-state output power. The impact of modulation doping is especially strong in short cavities.