This paper reports on-chip based optical detection with three-dimensional spatial resolution by integration of an optofluidic microscope (OFM) in a microfluidic pinched flow fractionation (PFF) separation device. This setup also enables on-chip particle image velocimetry (PIV). The position in the plane perpendicular to the flow direction and the velocity along the flow direction of separated fluorescent labeled polystyrene microspheres with diameters of 1μm, 2.1μm, 3μm and 4μm is determined by the OFM. These results are bench marked against those obtained with a PFF device using conventional fluorescence microscope readout. The size separated microspheres are detected by OFM with an accuracy of ≤0.92μm. The position in the height of the channel and the velocity of the separated microspheres are detected with an accuracy of 1.4μm and 0.08 mm/s respectively. Throughout the measurements of the height and velocity distribution, the microspheres are observed to move towards the center of the channel in regard to its height.