The piston-cooling system is one of the critical elements that impact on the thermal management of engines. At present, the use of a cooling gallery inside the piston head makes it possible to optimize the heat extraction and control the piston temperature effectively. However, owing to the small space in piston galleries and their complicated structure, it is rather difficult experimentally to perform accurate visual observations of the internal cooling oil and study the heat transfer characteristics. In the current work, a high-speed camera was employed to capture the flow patterns of water and air inside a simplified piston gallery at various crank angles. The heat transfer mechanisms in gas–liquid two-phase flow during reciprocating motion were explored. The effects of oscillation frequency and water filling ratio were discussed. An effective method was developed to achieve a full understanding of the flow and heat transfer characteristics of cooling medium inside a piston cooling gallery. This could provide an effective method to optimize the thermal management of engines in future.