Ultraweak light detectors have wide-ranging important applications such as astronomical observation, remote sensing, laser ranging, and night vision. Current commercial ultraweak light detectors are commonly based on a photomultiplier tube or an avalanche photodiode, and they are incompatible with microelectronic devices for digital imaging applications, because of their high operating voltage and bulky size. Herein, we develop a memory phototransistor for ultraweak light detection, by exploiting the charge-storage accumulative effect in CdS nanoribbon. The memory phototransistors break the power law of traditional photodetectors and follow a time-dependent exponential-association photoelectric conversion law. Significantly, the memory phototransistors exhibit ultrahigh responsivity of 3.8 × 109 A W-1 and detectivity of 7.7 × 1022 Jones. As a result, the memory phototransistors are able to detect ultraweak light of 6 nW cm-2 with an extremely high sensitivity of 4 × 107. The proposed memory phototransistors offer a design concept for ultraweak light sensing devices.