The high-precision integration of three-dimensional (3D) microoptical components into microfluidics in a customizable manner is crucial for optical sensing, fluorescence analysis, and cell detection in optofluidic applications; however, it remains challenging for current microfabrication technologies. This paper reports the in-channel integration of flexible two-dimensional (2D) and 3D polymer microoptical devices into glass microfluidics by developing a novel technique: flat scaffold-supported hybrid femtosecond laser microfabrication (FSS-HFLM). The scaffold with an optimal thickness of 1-5 mm is fabricated on the lower internal surface of a microfluidic channel to improve the integration of high-precision microoptical devices on the scaffold by eliminating any undulated internal channel surface caused by wet etching. As a proof of demonstration, two types of typical microoptical devices, namely, 2D Fresnel zone plates (FZPs) and 3D refractive microlens arrays (MLAs), are integrated. These devices exhibit multicolor focal spots, elongated (.three times) focal length and imaging of the characters 'RIKEN' in a liquid channel. The resulting optofluidic chips are further used for coupling-free white-light cell counting with a success rate as high as 93%. An optofluidic system with two MLAs and a W-filter is also designed and fabricated for more advanced cell filtering/counting applications.