Trescothick, 43, played 76 Tests for England between 2000 and 2006 and scored 5,825 runs at an average of 43.79.
"It's been an incredible 27 years and I've loved every minute of it," Trescothick told the official Somerset website.
Trescothick added: "However, everything has to come to an end eventually. I've been discussing my future with the club and my family for a while and we felt that now was the appropriate time to make this announcement in order for both the club and I to put plans in place.
"There's still a lot of the season left, and I'll be doing everything I can to put in performances for the second XI in order to force my way back into contention for the first team."
Trescothick has scored 19,654 first-class runs for his home county since making his Somerset debut in 1993.
During that time he has scored more first-class centuries (52) and more List A runs (7,374) than any player in Somerset's history.
Register for free to continue reading
Registration is a free and easy way to support our truly independent journalism
By registering, you will also enjoy limited access to Premium articles, exclusive newsletters, commenting, and virtual events with our leading journalists
Already have an account? sign in
Join our new commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies