Particle image velocimetry visualization to identify the complex flow structures in a sphere-packed pipe is carried out by using a matched refractive-index method with a sodium iodide solution as the working fluid. The following three flows were confirmed as representative flow structures in the pipe: a meandrous bypass flow with a high-flow velocity due to the wall effect, two pairs of unstable twin vortices accompanied by a strong impinging flow to the pipe wall, and a spouting flow from the central area of the pipe. In an experiment on heat transfer using water as the working fluid, the wall-temperature distribution is measured with thermocouples and infrared thermography, which makes clear a relation between the flow structures and the local heat transfer performance. Though an area with a high wall temperature is formed by the flow stagnation located at a contact point between the sphere and the heating wall, the colliding effect of the high velocity and of the meandrous bypass flow with the spheres significantly affects the heat transport from the stagnation areas. On the other hand, the heat transfer performance is quite high in a large gap area between the upstream and downstream spheres because of the influence of the strong impinging flow and the vortices that are both induced by the meandrous bypass flow.