The Mets sent reliever Tommy Hunter and minor league catcher Matt Dyer to the Rays.
Hill, 41, is 6-4 with a 3.87 ERA in 19 starts for the Rays this season. He had been scheduled to start Friday's game against Cleveland.
Hill has pitched just 95⅓ innings this year under limits imposed under the Rays' pitching strategy. This will be his 11th big league team in a 17-season career.
"I think a lot of people in the game know the name -- guy that's been around, pitching good baseball, pitching playoff baseball,'' Mets manager Luis Rojas said. "It's a great fit, great acquisition. Our front office is being diligent. One of the needs we've talked about is our starting pitching need and this is a guy that fits right in.''
Rojas said he didn't know yet when Hill could slot into the Mets' rotation. New York does not have scheduled starters yet for Sunday's series finale against the Toronto Blue Jays nor Monday's doubleheader against the Atlanta Braves.
The first-place Mets are in desperate need of starting pitching help, with ace Jacob deGrom and left-hander David Peterson on the injured list. New York started the day with a four-game division lead over Philadelphia and Atlanta despite a banged-up rotation.
In addition, Carlos Carrasco, who hasn't pitched in the majors this season, struggled in his most recent rehab start with Triple-A Syracuse, allowing three home runs in 1⅔ innings. Noah Syndergaard, who is working his way back from Tommy John surgery, had his rehab paused in May because of elbow soreness.
The Mets have used 15 different starting pitchers this season, tied with the Miami Marlins for most in the major leagues this season, according to ESPN Stats & Information data.
Tampa Bay began the day one game behind Boston in the AL East.
Rays general manager Erik Neander said "there was a numbers element'' to trading Hill, primarily to make room in the rotation for 21-year-old Luis Patino and the impending arrival of former All-Star Chris Archer.
Archer, who signed a one-year contract on Feb. 9, is on a rehab assignment with Triple-A Durham while recovering from right forearm tightness.
"There is a commitment to Chris, as long as he fulfills his side, to be here in August,'' Neander said. "We think the world of Rich, but this gives us the chance to balance our lineup.''
Hunter, 35, previously pitched for the Rays in 2017. The 14-year veteran has made four appearances for the Mets this season and hasn't allowed a run. The right-hander has a career ERA of 4.04. He was placed on the 10-day injured list on May 21 and transferred to the 60-day IL on June 11 with lower back pain.
Dyer, who is 23 and was drafted by the Mets in the fourth round in 2020, is hitting .194 with seven home runs and 20 RBIs for Class A St. Lucie this season.
ESPN's Jeff Passan and The Associated Press contributed to this report.