Thomas Middleditch has signed on for one of the lead roles in the CBS comedy pilot “B Positive,” Variety has learned.

Middleditch will now star alongside Annaleigh Ashford in the multi-camera comedy. Other announced cast members are Sara Rue and Kether Donohue.

In the show, faced with finding a kidney donor, newly divorced dad Drew (Middleditch) is at the end of his rope when he runs into Gina (Ashford), a rough-around-the edges woman from his past who volunteers her own. Together they form an unlikely bond and begin a journey that will change both of their lives.

Drew is a therapist who makes his living trying to fix other people’s problems. Described as educated, bookish, and neurotic, he lacks social skills and isn’t much of a people person.

The role in the pilot comes less than three months after the conclusion of the HBO comedy “Silicon Valley,” on which Middleditch starred throughout the show’s run. His time on the show earned him an Emmy nomination for best lead actor in a comedy series in 2016. On the feature side, he has recently appeared in “Godzilla: King of the Monsters,” “Zombieland: Double Tap,” and “The Wolf of Wall Street.”

He is repped by WME, Kirsten Ames Management, and Schreck Rose.

“B Positive” hails from writer and executive producer Marco Pennette. Chuck Lorre will executive produce via Chuck Lorre Productions Inc. Pennette already works with Lorre on the Anna Faris and Allison Janney CBS sitcom “Mom.” Warner Bros. Television, where Lorre is under a rich overall deal, will produce.