The widespread decline of farmland birds is a major issue of biological conservation in European countries. The Barn Swallow Hirundo rustica is a flagship species for farmland bird conservation owing to its aesthetic and cultural value and to the sharp decline observed in several populations. Based on a long-term monitoring project of a population in a protected area of Northern Italy, we documented a dramatic decline of 56.6% between 1999 and 2011, corresponding to a decrease of 6.59% each year. We also showed that colonies were on average larger in farms with livestock than those without livestock, and that colony size increased with increasing extent of hayfields within 200 m from the colony in farms without livestock, but not in those with livestock. Hayfield extent at greater distances did not influence population size or trend. Cessation of livestock farming therefore determined a decline in local colonies, but this decline may be buffered by an increase in hayfield extent within 200 m from the farm. However, variation in the ecological features of breeding sites explained only a fraction of the observed population decline, suggesting that ecological conditions during migration and wintering may be crucial in affecting population trends. Mean hatching date of first broods advanced in recent years, but less so in farms with, than without, livestock. Independently of year, mean hatching date advanced more in farms with greater extent of hayfields within 200 m of the colony. Reproductive success, measured as the mean number of fledged offspring per nest, declined significantly with hatching date, but was not affected by hayfield extent. Conversely, nestling quality, in terms of body mass and feather development, improved with increasing extent of hayfields around the colony, particularly in late-hatched first clutches. Our findings suggest that conservation strategies for this declining species should include both the maintenance of livestock farming and the enlargement of hayfields close to breeding colonies, particularly in farms where livestock farming has ceased.