The connection of large amounts of renewable energy needs to allow more regulatory resources to enter the ancillary services market(ASM) to improve the operational flexibility of the power system. Electricity retailers(ERs) or distribution companies can aggregate users' regulation resources to participate in the ASM and increase the competitiveness in the ASM. In this paper, the joint optimization model of ERs participating in the energy market(EM) and ASM under the background of joint optimization of EM and ASM is established. The example analysis shows that, in peak load periods, ERs can gain profits by participating in the ASM with demand response and distributed generation resources, and gain more profits by reducing the clearing price in the EM. Independent system operator should take some measures to encourage ERs to participate in the ASM and improve the flexibility of the power system.