Fabrication of 3D electronic structures in the micrometer-to-millimeter range is extremely challenging due to the inherently 2D nature of most conventional wafer-based fabrication methods. Self-assembly, and the related method of self-folding of planar patterned membranes, provide a promising means to solve this problem. Here, we investigate self-assembly processes driven by wetting interactions to shape the contour of a functional, nonplanar photovoltaic (PV) device. A mechanics model based on the theory of thin plates is developed to identify the critical conditions for self-folding of different 2D geometrical shapes. This strategy is demonstrated for specifically designed millimeter-scale silicon objects, which are self-assembled into spherical, and other 3D shapes and integrated into fully functional light-trapping PV devices. The resulting 3D devices offer a promising way to efficiently harvest solar energy in thin cells using concentrator microarrays that function without active light tracking systems.