To provide a semiconductor device in which the on-state current is high and the operation speed is high. The semiconductor device includes a transistor, a first circuit, and a second circuit. The transistor includes a first gate and a second gate. The first gate and the second gate overlap with each other with a semiconductor layer positioned therebetween. The first circuit includes a temperature sensor. The temperature sensor obtains temperature information. The first circuit is configured to apply a voltage to the second gate depending on the temperature information. The first circuit preferably includes a comparator. The second circuit is configured to apply a negative voltage to the second gate and hold the negative voltage.