Commercial success (2003–2017)
Perhaps her best-known role 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—and the related video game Enter The Matrix (2003). The character was 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 sequels earned over $91 million and $48 million during their North American opening weekends, respectively.
In the neonoir thriller Collateral (2004), alongside Jamie Foxx and Tom Cruise, Pinkett Smith played a U.S. Justice Department prosecutor and the target of a contract killer. The film was a critical and commercial success, grossing $217.8 million worldwide. She voiced Gloria, a strong, confident, but sweet hippopotamus, in the animated film Madagascar (2005). Tom McGrath, one of the film's directors, said they found all these traits in her voice when they listened to her. Despite a mixed response from critics, the film was a commercial success, earning $532 million worldwide, and becoming one of the biggest hits of 2005. In 2005, she published a children's book, Girls Hold Up This World, which landed at number two on The New York Times Best Seller list. In 2007, she played the wife of an affluent dentist in the drama Reign Over Me, with Adam Sandler, Don Cheadle, Liv Tyler, and Donald Sutherland. Entertainment Weekly called the film a "strange, black-and-blue therapeutic drama equally mottled with likable good intentions and agitating clumsiness", and found Pinkett Smith "graceful" in it.
In 2008, Pinkett Smith took on the role of a lesbian author in the all-female comedy The Women, opposite Meg Ryan, Annette Bening, Debra Messing, and Eva Mendes. Though a commercial success, The Women was panned by critics, with Pinkett Smith earning a nomination for the Golden Raspberry Award for Worst Actress for her performance. Her directorial debut was the drama The Human Contract (also 2008); she also wrote it, and starred as the sister of a successful but unhappy businessman, with Paz Vega and Idris Elba. It debuted at the Cannes Film Festival in May 2008. The success of Madagascar led Pinkett Smith to return to the role of Gloria in the 2008 sequel Madagascar: Escape 2 Africa, which earned US$603 million at the international box office.
Pinkett Smith was an executive producer and starred as a Chief Nursing Officer in the TNT medical drama Hawthorne, which premiered on June 16, 2009. USA Today remarked: "Pinkett Smith's Hawthorne is tired in every sense of the word, and she's not the only one. Every character and event falls under the category of painfully predictable". Hawthorne ended on August 16, 2011, after three seasons. In 2010, she earned a nomination for the Tony Award for Best Musical as a producer for the Broadway musical Fela!. While she reprised the voice role of Gloria in Madagascar 3: Europe's Most Wanted (2012), which made over US$746 million, she also voiced the character in the NBC Christmas special Merry Madagascar (2009) and the direct-to-DVD film Madly Madagascar (2013).
Beginning in 2014, Pinkett Smith starred in the first season of the FOX crime drama Gotham, as Gotham City gangster Fish Mooney. She returned, recurrently, in the second and third seasons of the series. In 2015, she starred in the comedy Magic Mike XXL, as the manager of a star stripper club, opposite Channing Tatum and Joe Manganiello. The film made US$122.5 million worldwide. She starred with Mila Kunis, Kristen Bell and Christina Applegate in the comedy Bad Moms (2016), as the sidekick of a domineering parent-teacher association head. It received mixed reviews from critics, who praised the cast and humor, though did not feel it could "take full advantage of its assets". The film, nevertheless, earned more than US$183.9 million.
Pinkett Smith next took on the role of a nurse and uptight mom in the comedy Girls Trip (2017), alongside Regina Hall, Queen Latifah, and Tiffany Haddish. The film was chosen by Time magazine as one of its top ten films of 2017, and grossed US$140 million worldwide, including over US$100 million domestically, the first comedy of 2017 to do so. In July 2017, Pinkett Smith appeared at the Essence Festival where, on the Empowerment Stage, she appeared to talk alongside Queen Latifah. Pinkett Smith spoke highly of the cast reflecting their characters in real life, stating that they are all women who love other women and work to empower each other, a feature that she notes as rare in Hollywood.