Three candidates entered the race to succeed the East Lothian MSP, who hung on to his seat by just 151 votes in a poor night for his party at the Holyrood election in May.
MSPs Johann Lamont and Ken Macintosh and MP Tom Harris contested the election, which will give the winner overall control of the party in Scotland for the first time, rather than just the Holyrood group.
Mr Gray will make his final appearance at First Minister’s Questions today, and the result of the leadership election will be announced on Saturday.
Mr Macintosh, MSP for Eastwood, said: “I have enjoyed talking about how we’ll take our party forward with hundreds of members at dozens of events across the country. I want to thank all of those who gave up their time to contribute to that.”
Ms Lamont said the contest had invigorated the party.