Castrovillari is a town and comune in the province of Cosenza in the Calabria region of southern Italy.