The company said it will take half the electricity the 48-turbine Fallago Rig site in the Lammermuir Hills generates over the next 20 years.
That will allow BT to match the power consumption of its Scottish operations which is currently running at around 170 gigawatt hours a year.
Brendan Dick, BT Scotland director, said: "It's fantastic that all of our Scottish infrastructure and estate will be matched with energy from renewable sources in Scotland in a deal which gives us long-term price certainty.
"BT is one of the UK's biggest consumers of electricity, and demand for our digital services, including fibre broadband, means we have to keep innovating to meet our needs in an environmentally responsible way."
Fallago Rig is the fifth largest onshore wind farm in the UK and majority-owned by funds operated by Hermes GPE Infrastructure.
EDF has a minority stake in the site, which is on land owned by the Duke of Roxburghe, and manages the wind farm.
Energy Minister Fergus Ewing said the BT deal secures generation at the site for the long-term.