Two-dimensional ZnO materials have attracted considerable attention in scientific research and industrial applications due to their special physical and chemical properties. Understanding the structural transformation of few-layer ZnO is a prerequisite for further exploring its the optoelectronic properties. In this work, the layer thickness effects on the phase transition and electronic properties of few-layer ZnO were systematically investigated using the first-principles calculations based on the DFT + U method. Few-layer ZnO transforms from planar structure to 8|4 Haeckelite structure with the layer thickness ranging from 1 to 17, and then reconstructs into wurtzite structure as the layer increases from 18 to 20. The planar-to-Haeckelite-to-wurtzite structural transformation occurs at thicknesses of 11 layers and 18 layers. Moreover, few-layer ZnO with planar structure, 8|4 Haeckelite structure, and wurtzite structure exhibits energetic, mechanical and thermal stability. Few-layer ZnO with planar and 8|4 Haeckelite structures exhibits semiconducting behavior with the calculated band gaps of 2.963 eV and 2.587 eV, respectively. In contrast, few-layer ZnO with wurtzite structure becomes metallic due to the existence of surface states. Strain also can greatly modify the electronic properties of few-layer ZnO with 8| 4 Haeckelite and planar structures. Of special interest is the strain-induced transformation from direct to indirect band gap in the planar structure under available external strain. Our findings provide theoretical guidance for modulating the electronic properties of few-layer ZnO via thickness effects for nanoelectronic applications.