The 39-year-old has made 312 international appearances, scoring 128 goals for the USA women’s soccer team (USWNT).
Lloyd, who had a loan spell at Manchester City in 2017, won two World Cups and two Olympic golds.
“Every single day I stepped out onto the field, I played as if it was my last game,” she said.
USWNT head coach Vlatko Andonovski said Lloyd is “a true legend” and he has “been honoured to coach her”.
Lloyd will play in four final international matches as well as the remainder of the NWSL season with her club side, NJ/NY Gotham, before hanging up her boots.
Lloyd first started playing in 1999 for W-League side Central Jersey Splash while still in high school.
She made her international debut against Ukraine in 2005 at 22 and is the second-most capped player in US and world history behind Kristine Lilly on 354.
She added: “I never wanted to take anything for granted, especially knowing how hard it is to get to the top, but even harder to stay at the top for so long.
“I am forever grateful to have represented the crest and to be able to play for my country.
“I will continue to support and cheer this team on and continue to find ways to help grow the game and inspire the next generation.”
Lloyd, who scored in Manchester City’s 4-1 Women’s FA Cup final victory over Birmingham during her short spell, has said she wants to start a family with her husband, professional golfer Brian Hollins.
She also plans to continue leading football clinics with young players once she retires.