Also in 2001, Pinkett Smith played the supporting role of Sonji Roi, the first wife of famous boxer Muhammad Ali, in the biographical film Ali. This marked the first film that she would participate in with her husband, actor Will Smith, who portrayed Ali. The film received mostly good reviews from critics and earned her a nomination from the NAACP Image Awards for Outstanding Supporting Actress in a Motion Picture. Perhaps her best-known role to date is the part of human rebel Niobe in the films The Matrix Reloaded (2003) and The Matrix Revolutions (2003), sequels to 1999's The Matrix. She had met the series' directors, The Wachowski Brothers, before they had begun to film The Matrix and they formed a close bond. The character was eventually written, specifically, with Pinkett Smith in mind. Directly after she filmed her scenes for Ali, Pinkett Smith flew to Australia to work on the Matrix sequels. The role brought into the spotlight, as The Matrix already had a cult following of fans, and the sequels earned over $91 million and $48 million during opening weekends, respectively. Her acting in The Matrix Revolutions earned her another nomination for the Image Award for Outstanding Supporting Actress in a Motion Picture.
In 2004, Pinkett Smith reunited with director Michael Mann, whom she had worked with on Ali, to play United States Department of Justice prosecutor Annie Farrell, in the thriller Collateral, co-starring Tom Cruise and Jamie Foxx. She later provided the voice of Gloria the hippo in the DreamWorks animated film Madagascar (2005). Director Eric Darnell stated, "[Pinkett Smith]'s got all this incredible power and attitude and strength and confidence, which is just what we wanted for Gloria the hippo." She reprised her role for the sequel, Madagascar: Escape 2 Africa, released in November 2008.
Pinkett Smith returned to drama when she co-starred with Adam Sandler and Don Cheadle in Reign Over Me (2007). The film revolves around a lost friendship between Charlie Fineman (Sandler) and Dr. Alan Johnson (Cheadle) which is rekindled after Fineman loses his family to the September 11 attacks on the World Trade Center. Pinkett Smith played Johnson's wife Janeane. In 2008, Pinkett Smith portrayed Alex Fisher, a lesbian author, in The Women. The film co-starred Meg Ryan, Annette Bening, Eva Mendes, and Debra Messing, and was directed by Emmy Award-winner Diane English. Pinkett Smith's directorial debut was The Human Contract; she also wrote and acted in the movie. Starring Paz Vega and Idris Elba, it debuted at the Cannes Film Festival in May 2008. As of January 2009, she has been working on the TNT medical drama Time Heals, in which she is executive producer and a starring cast member. The show has been greenlit for 10 episodes.