Margetts has played two league games for the Iron since arriving from Lincoln City in August.
Crewe will be the 23-year-old's seventh club since January 2016, having had loan spells with Stockport, Southport and Altrincham while at Tranmere.
Cooke, 19, is yet to play first-team game for Middlesbrough.
Find all the latest football transfers on our dedicated page or visit our Premier League tracker here.
Crewe have signed Scunthorpe striker Jonny Margetts and Middlesbrough midfielder Callum Cooke on loan until the end of the season.