The 'Silicon Valley' star was among the most sought-after actors this pilot season.

CBS has scored a pilot season casting coup.

Silicon Valley star Thomas Middleditch will lead the network's comedy B Positive, from mega-producer Chuck Lorre. Middleditch, one of the most sought-after actors of this pilot cycle, joins Annaleigh Ashford, Kether Donohue and Sara Rue in the cast.

The actor will play Drew, a recently divorced father who's in need of a kidney donor. At the end of his rope, Drew runs into Gina (Ashford, Masters of Sex), a rough-around-the-edges woman from his past, who offers her kidney. The two 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. Educated, bookish and neurotic, he lacks social skills and isn't much of a people person. Frequent Lorre collaborator Rue plays his ex-wife, Julia, and Donohue (You're the Worst) will play a "party girl" named Leanne.

HBO's Silicon Valley, for which Middleditch earned an Emmy nomination in 2016, ended its six-season run in December. The actor's credits also include Zombieland: Double Tap, Godzilla: King of Monsters and Tag, and he's part of the voice cast for Hulu's Solar Opposites from Rick and Morty co-creator Justin Roiland. Middleditch is repped by WME, Kirsten Ames Management and attorney Isaac Dunham.

Marco Pennette (Mom) wrote the multicamera B Positive and executive produces with Lorre. The Warner Bros. TV project is one of two pilots Lorre has at CBS this season, along with United States of Al, about the friendship between a Marine veteran (Parker Young) and his unit's Afghan translator (Adhir Kalyan), who has recently moved to the U.S.

The pilots will seek to join two other Lorre shows, Mom and Young Sheldon, on CBS' 2020-21 schedule. Lorre's third series at the network, the first-year comedy Bob Hearts Abishola, is awaiting word on its future.