Following Happy Endings, she starred in the 2006 films Trust the Man, Stranger than Fiction, Monster House, World Trade Center and Sherrybaby. In Trust the Man, featuring Julianne Moore, David Duchovny and Billy Crudup, she played Elaine, who has been dating Tobey, Crudup's character, for seven years and has begun to feel that it is time for her to settle down and start a family. The film was critically and financially unsuccessful. Ethan Alter of Premiere felt that the performances by Gyllenhaal and Duchovny were "much more at ease" and concluded with "that's probably because they're played these characters many times before". In Stranger than Fiction, Gyllenhaal played a love interest of Harold Crick, played by Will Ferrell. Her performance in the film received favorable reviews; Mike Straka of Fox News wrote: "Gyllenhaal has never been sexier in any film before and her interplay with Ferrell will propel her to more A-list films, leaving her indie-darling days behind, no doubt." She voiced Elizabeth "Zee" in the computer animated horror film Monster House. Gyllenhaal depicted Alison Jimeno, the wife of Port Authority officer Will Jimeno, in Oliver Stone's World Trade Center, based on the September 11 attacks on the same-title towers of New York City. She regarded this as "one of the films she most enjoyed making". The film received favorable reviews and proved to be an international success, earning $163 million worldwide.
In Sherrybaby, Gyllenhaal played a young, drug-addicted thief trying to put her life in order after prison so she can reconcile with her daughter. During promotion of the film, she noted of her portrayal of the character: "I think she's in such dire straights that all she has are these kind of naive, fierce hope. And while I was playing the part I was looking for pleasure and hope in everything, even in these really bleak things. And so it was really mostly after I finished the movie that I felt pain." Her performance in the film was well received: David Germain of the Associated Press wrote, "Gyllenhaal humanizes her so deeply and richly... that Sherry elicits sympathy even in her darkest and weakest moments", and Dennis Harvey of Variety called her performance "naturalistic". For her work, Gyllenhaal earned her second Golden Globe Best Actress nomination and won the Best Actress category award at the 2006 Stockholm International Film Festival. In February 2008, Gyllenhaal was cast to play Suky in Rebecca Miller's The Private Lives of Pippa Lee but pulled out before production began and was replaced by Maria Bello. In 2008 she finished filming the comedy Away We Go, to be released in 2009, in which she plays a bohemian college professor who is an old friend of John Krasinski's character.
She appeared in The Dark Knight (2008), the sequel to Batman Begins (2005), in which she replaced Katie Holmes as Assistant District Attorney, Rachel Dawes. Gyllenhaal acknowledged her character was a damsel in distress to an extent, but said director Christopher Nolan sought ways to empower her character, so "Rachel's really clear about what's important to her and unwilling to compromise her morals, which made a nice change" from the many conflicted characters she had previously portrayed. The Dark Knight was a big financial success, setting a new opening weekend record at the North America box office. With revenue of $996 million worldwide, it became the fourth highest grossing film of all time. In a Salon.com review of the film, Stephanie Zacharek called Gyllenhaal's character "a tough cookie in a Stanwyck-style bias-cut gown" and stated that "the movie feels smarter and more supple when she's on-screen". IGN film critic Todd Gilchrist wrote, "Gyllenhaal adds real depth and energy to Rachel Dawes."
Gyllenhaal played Yelena in the Classic Stage Company's 2009 Off-Broadway production of Anton Chekhov's Uncle Vanya in New York City. The cast also includes Peter Sarsgaard, Mamie Gummer, Denis O'Hare, and George Morfogen. The production, directed by Austin Pendleton, began previews on January 17 and ended its limited run on March 1. Joe Dziemianowicz of the New York Daily News, was somewhat less enthusiastic with her performance, writing: "Gyllenhaal, who was so dynamic as a druggie in the film Sherrybaby, plays Yelena with a slow-mo saunter and monotonous pasted-on smile that makes it seem as if she's been in Sherry's stash." However, Malcolm Johnson of the Hartford Courant was complimentary towards her, noting that she "ultimately blossoms" as the character.