Onions took the first four wickets, including a spell of 3 for 2 in nine balls, to reduce the second-placed visitors to 18 for 3 before Compton dominated stands of 54 with James Franklin and 66 with Neil Dexter.
The total was on 138 when Compton was fifth out for 71, gloving a leg-side catch to wicketkeeper Michael Richardson when trying to pull John Hastings.
It was an unfortunate end to an assured innings, in which he left anything he didn’t need to play at but hit nine firmly-struck fours, mainly through pulls and cover drives.
Middlesex were put in on an overcast morning and the first rain interruption, lasting 25 minutes, arrived after seven balls.
Onions, out of sorts for much of the season, has worked hard at regaining his previous high standards and had his rewards on a day when his support was below par.
His first ball – the seventh of the morning – was cut for four by Sam Robson but after the rain break a ball from Onions started on leg stump and swung past Robson’s outside edge, bringing a huge but unsuccessful appeal for caught behind.
Paul Stirling and Robson both fell when shaping to drive, the Irishman going first when he edged to Paul Collingwood at first slip.
Late in-swing found Robson’s inside edge on the way to middle stump, which was sent flying, and three balls later Onions swung one into in-form left-hander Dawid Malan to have him lbw.
With three seamers injured, Durham handed a debut to James Weighell, an academy product from Teesside.
He came on first change and after opening up with a maiden he conceded seven off his second over and made way for John Hastings.
Both the Australian and Chris Rushworth, in his second spell, bowled round the wicket to left-hander Franklin without making him play often enough.
Franklin was unusually restrained in making 16 of 54 balls before he played inside an in-swinger from Onions and edged it to Collingwood straight after lunch.
Occasional extravagant seam movement allowed Weighell to beat Compton on 59, but two balls later Dexter clipped him through midwicket for an all-run four. Dexter was on 23 when the rain arrived with John Simpson on 2, Crickinfo reports.