Variation in foraging success in relation to spatial position in a group is little known in species that feed on mobile prey that can hide or flee upon disturbance by foragers. I examined the foraging success of individuals located either at the edge or at the centre of flocks of semipalmated sandpipers (Calidris pusilla) feeding on a burrowing amphipod (Corophium volutator) during migration stopover in the Bay of Fundy, Canada. The rates of pecking, prey capture and success were lower for individuals foraging at the edge than at the centre of flocks. Edge birds spent more time running and more time flying than centre birds. Edge birds moved away from the centre of the flock and made frequent short flights towards the centre. In contrast, centre birds rarely moved in a specific direction and flew mostly to relocate elsewhere with the whole flock. Sandpiper flocks foraged over a large area in a relatively short amount of time. In addition, amphipod density is high in this habitat. It thus appears unlikely that prey depletion or low food availability at the edges of groups could explain the spatial variation in foraging success. Low foraging success at the edges of flocks thus arose mainly because of time costs related to flock expansion and retraction. The effect of mutual interference among foragers and of predation risk by falcons is discussed with respect to flock expansion and retraction.