Both will get multi-year contracts.
Castillo, 28, will sign a three-year deal worth $16 million. Reports indicate a fourth season is possible. The second baseman recently won his first Gold Glove.
The veteran switch-hitter batted .314 with 99 runs scored and 21 stolen bases last season.
Lowell, a two-time All-Star third baseman who was eligible for arbitration, had career highs with 32 homers and 105 RBI.
Over his last four years, he has 96 home runs and 388 RBI.
"Mike's production and what it means to the ballclub is well-documented," said General Manager Larry Beinfest. "We were following up on a promise to him. You never really know if it will get done or not. We want both players to be Marlins for years to come."
The Marlins now set their sights on catcher Ivan "Pudge" Rodriguez. They have until Sunday to sign the potential free agent.