The MacGyver actor will play himself in the ABC sitcom - which also stars James Van Der Beek (Dawson's Creek) - according to The Hollywood Reporter.
The 62-year-old is the latest star to parody himself on the series, following appearances from Mark-Paul Gosselaar (Saved by the Bell), Frankie Muniz (Malcolm in the Middle), Dean Cain (Lois & Clark: The New Adventures of Superman) and Kevin Sorbo (Hercules: The Legendary Journeys).
In addition to his Stargate and MacGyver roles, Anderson has made recent appearances on NBC's Raising Hope and USA's Fairly Legal.
Don't Trust the B---- in Apartment 23 has struggled in the ratings since its second season launched on ABC in October - the most recent episode hit a series ratings low of just 2.99 million viewers.
The new episodes will air on E4 in the UK in early 2013.
> James Van Der Beek talks Dawson's Creek reunion on Apartment 23
> Apartment 23 star Krysten Ritter has never seen Dawson's Creek
Watch a clip from Don't Trust the B---- in Apartment 23 below: