A semiconductor device comprising: a first transistor; a second transistor (162, 166); and a capacitor; wherein the first transistor comprises: a first gate electrode over a semiconductor with a first insulating layer interposed therebetween; and source and drain electrodes (130a, 130b) electrically connected to first and second impurity regions (114, 120) in the semiconductor; wherein the second transistor (162, 166) comprises: a first source or drain electrode and a second source or drain electrode over a second insulating layer provided over the first gate electrode; an oxide semiconductor layer over the second insulating layer and electrically connected to the first source or drain electrode and the second source or drain electrode; a third insulating layer over the first source or drain electrode, the second source or drain electrode, and the oxide semiconductor layer; and a second gate electrode over the oxide semiconductor layer with the third insulating layer interposed therebetween; wherein the capacitor comprises: a third electrode over the first source or drain electrode with the third insulating layer interposed therebetween, so that the capacitor is formed with the first source or drain electrode, the third insulating layer and the third electrode; and wherein the first gate electrode and the first source or drain electrode are electrically connected to each other. a first transistor; a second transistor (162, 166); and a capacitor; wherein the first transistor comprises: a first gate electrode over a semiconductor with a first insulating layer interposed therebetween; and source and drain electrodes (130a, 130b) electrically connected to first and second impurity regions (114, 120) in the semiconductor; a first gate electrode over a semiconductor with a first insulating layer interposed therebetween; and source and drain electrodes (130a, 130b) electrically connected to first and second impurity regions (114, 120) in the semiconductor; wherein the second transistor (162, 166) comprises: a first source or drain electrode and a second source or drain electrode over a second insulating layer provided over the first gate electrode; an oxide semiconductor layer over the second insulating layer and electrically connected to the first source or drain electrode and the second source or drain electrode; a third insulating layer over the first source or drain electrode, the second source or drain electrode, and the oxide semiconductor layer; and a second gate electrode over the oxide semiconductor layer with the third insulating layer interposed therebetween; a first source or drain electrode and a second source or drain electrode over a second insulating layer provided over the first gate electrode; an oxide semiconductor layer over the second insulating layer and electrically connected to the first source or drain electrode and the second source or drain electrode; a third insulating layer over the first source or drain electrode, the second source or drain electrode, and the oxide semiconductor layer; and a second gate electrode over the oxide semiconductor layer with the third insulating layer interposed therebetween; wherein the capacitor comprises: a third electrode over the first source or drain electrode with the third insulating layer interposed therebetween, so that the capacitor is formed with the first source or drain electrode, the third insulating layer and the third electrode; and wherein the first gate electrode and the first source or drain electrode are electrically connected to each other.