The 22-year-old linked up with Wayne Brown's men on transfer deadline day on Thursday and will remain with the U’s until the next transfer window.
Longstaff spent time out on loan at Aberdeen last term, where he made five appearances, before a productive spell at Mansfield Town during the second half of the campaign saw the Magpies' academy graduate saw six goals in 16 outings as the Stags made it to the League Two play-off final.
So far, he has made 20 appearances for United, scoring three times, and has been capped twice by England Under-20s.
Longstaff could make his debut for the U's in their fourth tier clash with Hartlepool United at the JobServe Community Stadium on Saturday.