The 34-year-old -arm spinner has been struggling with a hip injury for over a year.
Giles took 143 wickets in 54 Tests and one of his best performances came during his final appearance at The Kennington Oval where he made a Test-best 59 and shared in a decisive 109-run eighth wicket stand with Kevin Pietersen, which secured the draw that won the Ashes two years ago.
His Test debut was against South Africa at Old Trafford in 1998 and his final Test match was against Australia in Adelaide in December 2006.
Giles, in a statement issued by the England and Wales Cricket Board (ECB), said: "Following guidance from my hip surgeon, Dr Marc Philippon, I am very sorry to announce that I am retiring from all forms of cricket with immediate effect.
He added: "I had hoped to make a full recovery and return to playing over the next few months but the advice I have received means that there is no chance of me returning to cricket at any level."
Giles, who also played 178 County Championship matches for Warwickshire, added: "I would have liked to have cricket at the very top still playing the game that I have always loved and whether it be on the village green or Test arena.
"But I have no regrets. I will always have great memories of being part of a fantastic Warwickshire and England dressing room.
"It has been a huge honour to play for my country and to play a part in one of the most successful periods in its cricketing history. I dreamt of playing cricket for England and winning the Ashes as a child and so to be part of that magical summer of 2005 was truly a dream realised.
"Cricket has been my job, my joy, my life. We must cherish the game and respect it at all levels. I have always tried to do so. I hope I have been good to the game because it has been very good to me.
"I finish by thanking Warwickshire and England for giving me such great support during difficult periods of injury and rehabilitation. I wish both teams great success in the coming years."
England captain Michael Vaughan added: "Ashley's retirement is very sad news and everyone in the England dressing room will miss his professionalism and, of course, his sense of humour.
"In my view, Ashley has to be one of the most underrated cricketers ever to pull on an England shirt. He was a key member of the England Test side which won six successive Test series and I know how much his team-mates valued his contributions to our success."
Giles, having played in the first two of England's Test in Pakistan in November 2005 was then sidelined by hip trouble.
But he recovered in time to be controversially chosen ahead of Monty Panesar for the first two Tests of the 2006-07 Ashes.
However, after returning home early from Australia for family reasons, he got injured again and has now had three operations in the last 18 months.
During his England career he was often criticised for bowling in a defensive fashion, although that had much to do with the tactics of then England captain Nasser Hussain, whose oft-repeated comments the team needed a "mystery spinner" can't have done much for the sensitive Giles's self-esteem.
Giles, who also played 62 one-day internationals and was a fine gully fielder, is now set for a career in the media having already broadcast on the ongoing England-India series, for BBC Radio Five. The third and final Test started at The Oval on Thursday.