EXCLUSIVE

James Avery -- the beloved dad on "The Fresh Prince of Bel-Air" -- has died at age 68 ... TMZ has learned.

Sources close to the actor tell TMZ he died in a Glendale, CA hospital last night. Avery had undergone open heart surgery and took a turn for the worse late yesterday.

And we're told ... his wife, Barbara, had been at his bedside but left for a short period of time and when she came back ... she learned he had just died.

Alfonso Ribeiro -- who played Avery's son on "Fresh Prince" -- just posted a message on his Facebook page.

Avery starred in dozens of TV shows through the years -- shows like "Grey's Anatomy," "The Closer," "L.A. Law," and "The Jeffersons." This past year, he appeared in three TV movies -- most recently, "Go, Bolivia, Go!" -- but didn't appear to have other projects in the works.

Avery reunited with most of his "Fresh Prince" cast -- including Will Smith -- two years ago at a charity event.