In this paper, A 170GHz frequency doubler based on thermal optimization with high output power is proposed. The gap between different rows of anodes is optimized by thermal simulation, while the effect of the phase difference caused by different rows of anodes is also considered. The influence of thermal coupling effect and phase difference on the performance of the frequency doubler is compromised to achieve the best performance. With the input power of 29dBm and the diode bias voltage of -11V, the simulated output power is above 100 mW for the frequency band 165-175GHz.The maximum output power is 107 mW at 172GHz. Compared with the frequency doubler without thermal optimization, the efficiency of the frequency doubler is increased by 3.1%, and the power handling capacity of the frequency doubler can be improved through optimization.