ZnO and Al-doped ZnO (AZO) thin films were grown on the ZnO buffer layer by a chemical spray pyrolysis method. The metalsemiconductor-metal (MSM) UV photodetector based on ZnO thin films with two device configuration Ag/AZO/ZnO/Ag and Ag/ZnO/ZnO/Ag have been studied. AZO and ZnO thin films were grown on the ZnO buffer layer by a chemical spray pyrolysis technique. The effect of the buffer layer on the physicochemical and UV-sensing properties of the AZO and ZnO thin-film-based UV photodetectors were analyzed. The XRD results suggested that the buffer layer improves the crystalline quality of the ZnO thin films. The device with configuration Ag/AZO/ZnO/Ag exhibits a maximum photocurrent of about 876 mA at 5 V bias at 365 nm peak wavelength. The linear I-V characteristic of the photodetector reveals the good ohmic contacts between metal-semiconductor junctions. The AZO-based UV photodetector with ZnO buffer layer shows a maximum photoresponsivity of about 340 A/W, which is much higher than that of the ZnO-based UV photodetector with ZnO buffer layer. The photoresponse and photoswitching characteristics of the device demonstrate that a ZnO UV photodetector with a buffer layer offers a new way to fabricate devices on a buffer-layer-coated substrate.