Gul represented Pakistan in 47 Tests, 130 ODIs and 60 T20Is.
Gul made the decision after his side Balochistan were knocked out of the National T20 Cup with the loss against Southern Punjab.
WATCH: Umar Gul shares his experience of playing in IPL for Kolkata Knight Riders
"It has been an honour to represent my club, city, province and country at various levels for two decades. I have thoroughly enjoyed my cricket, which has taught me the values of hard work, respect, commitment and determination," Gul said after the game, as quoted by ESPNcricinfo.
"During this journey, I have had the pleasure of meeting numerous people who have helped and supported me in some way. I want to thank all those people as well as my teammates and peers for their support.
"I owe a big thank you to the fans who supported me throughout my journey. They have been an inspiration, especially at times when the going was not great.
"Lastly, I thank my family for standing firmly behind me throughout my career and helping me to cherish my dreams of not only playing cricket but traveling across the country and globe. They have sacrificed a lot, while I too have missed their presence and company.
"I now look forward to spending valuable time with them but it will be difficult to stay away from cricket and I now look forward to giving back to the sport and the country that has made me one of the most fortunate people on the planet."
Having made his international debut in 2003, Umar Gul represented Pakistan in 47 Tests, 130 ODIs and 60 T20Is. He was particularly known for his exploits in white-ball cricket, where his ability to bowl yorkers on a regular basis earned him a lot of praise.
Gul played a key role in Pakistan’s 2009 T20 World Cup triumph, taking 13 wickets in the marquee event from 7 games at an average of 12.15 and economy of 6.44. His last international appearance came against England in 2016.