Grey's Anatomy and other projects (2006–2021)
After success on Broadway, Ramírez joined the cast of the ABC medical drama Grey's Anatomy in a recurring role as Dr. Callie Torres, a love interest for Dr. George O'Malley, in the show's second season. On a special Grey's Anatomy-themed episode of The Oprah Winfrey Show, Ramírez revealed that top executives from ABC, who were greatly impressed by their performance in Spamalot, offered them a role in any ABC show they wanted. Ramírez picked Grey's, as they were already a fan of the show. Ramírez further explained that at their initial audition, the producers liked them and intended to add them to the show but did not know who to cast them as. Ramírez also said they were in awe of how the executives said, "Pick a show, any show," explaining that it is rare. The series creator and executive producer, Shonda Rhimes explained, "I was looking for a girlfriend for George, but it was in the infancy stages, so I had no idea what I was looking for." Rhimes built the character around Ramírez after Rhimes met them. Ramírez, who was initially given a recurring status at the time of the character's inception, received a star billing in the show's third season, alongside fellow cast member Eric Dane, who portrayed Dr. Mark Sloan.
Ramírez provided a cappella vocals in the song "Silent Night" for the soundtrack of the show's sixth-season episode "Holidaze," airing on November 19, 2009. Ramírez served as the main vocalist for the musical episode of Grey's Anatomy, "Song Beneath the Song", which aired on March 31, 2011. Marcus James Dixon of Gold Derby called them the "show-stopper" and wrote that they "stole the show in a gut-wrenching performance worthy of an Emmy award."
As the series progressed, the character's popularity soared and Ramírez garnered widespread recognition and critical acclaim for their portrayal of a complex character on television. Maggie Fremont, a TV critic for Vulture, reviewed Ramírez and Jessica Capshaw's performances during an 11th season episode, calling them "goddesses walking amongst mere mortals". Ramírez was nominated for Outstanding Actress in a Drama Television Series at the Alma Awards in 2007 and 2008. Also in 2007, at the 13th Screen Actors Guild Awards, the cast of Grey's Anatomy received the Award for Outstanding Performance by an Ensemble in a Drama Series. They and the cast were nominated for the same award in 2008. In 2011, at the 42nd NAACP Image Awards, Ramírez was nominated for Outstanding Supporting Actress in a Drama Series.
In May 2016, Ramírez left the show at the conclusion of the 12th season, after having played the character for a decade. They released a statement saying, "I'm deeply grateful to have spent the last 10 years with my family at Grey's Anatomy and ABC, but for now I'm taking some welcome time off." Rhimes wrote of Ramírez's work on the show, "Dr. Callie Torres came into our lives dancing it out in her underwear almost a decade ago, and I could not be happier or more proud of her journey. Sara Ramírez's performance inspired me as well as millions of fans each week."
Ramírez turned producer with the 2016 teen comedy film, Loserville. The project was released in partnership with the Pacer Foundation's Center for Bullying Prevention & Stomp Out Bullying.
From 2017 to 2019, Ramírez co-starred in the fourth and fifth seasons of the CBS political drama Madam Secretary, replacing Bebe Neuwirth, who played Nadine Tolliver. They played Kat Sandoval, the new policy advisor of Secretary Elizabeth McCord (Téa Leoni).
In 2021, Ramírez was cast as non-binary podcast host and comedian Che Díaz in the Sex and the City revival series And Just Like That.... The character of Díaz has received universally negative reviews from fans and critics, with Kevin Fallon of The Daily Beast calling them "the worst character on TV."