The move ends a 22-year association between Humphreys and the Province. He made 162 appearances for Ulster as a player and won the European Cup, the Celtic Cup and the Celtic League. He retired from playing in 2008 and took up a role as Operations Director before becoming Director of Rugby four years ago.
Commenting, Humphreys said: "This was a really difficult decision for me personally but having received a direct approach from Gloucester, I have now chosen to accept an offer to become their Director of Rugby. It is, I believe, the right move for me at this stage of my career.
"I would like to thank the supporters and all those involved in Ulster Rugby over more than two decades who have lent me support, encouragement and wisdom.
"There is no doubt that the Province will continue to move forward. It has a fantastic stadium, the best supporters and a wealth of great talent coming through. Ulster Rugby will be a force within rugby for many years to come."
Chief Executive of Ulster Rugby, Shane Logan, said: "I would like to wish David every success with Gloucester and to thank him for the outstanding contribution that he has made to Ulster Rugby.
"As Director of Rugby, David has helped to grow the game at all levels - there are more people playing rugby in the Province than ever before, we have successful age-grade sides, we have a strong Academy and we now have a senior squad that can beat the best in Europe.
"We are disappointed with the decision but respect David's decision to leave Ulster. We know we already have the structures in place to ensure we have success in the long term.
"Ulster Rugby will now begin the process of recruiting a new Director of Rugby and we look forward to building on the progress that the Province has made in recent years."
Guinness PRO12
Suite 208, Alexandra House,
The Sweepstakes
Ballsbridge, Dublin 4, Ireland