Gray, who has spent ten years in his current role, will leave the bank next month.
The news comes amid changes to leadership at Barclays after CEO Anthony Jenkins' departure was announced recently. John McFarlane will be appointed Executive Chairman from 17 July when he retires from FirstGroup, until a permanent successor is appointed.
A Barclays spokesperson said:
“Andy Gray, Managing Director of Mortgages has decided to leave Barclays at the beginning of August, after 18 years of service. Andy has played a crucial role in shaping the mortgage business to be a leading and innovative lender, and we wish him all the best for the future.
“Raheel Ahmed from Standard Chartered will be taking on the role of Managing Director, Mortgage Products & Customers from August and will be responsible for the strategic growth of the mortgage business.”