Pennsylvania Sen. Pat Toomey’s (R) victory appears to also have put his colleagues over the top in terms of holding the GOP Senate majority. It also seems to be linked closely to Donald Trump’s fortunes in the Keystone State — he held a slight lead over Hillary Clinton when the Associated Press called the Senate race.

The AP projected shortly after 1a.m. on Wednesday morning that Toomey would win, and Republicans would maintain control of the hotly-contested upper chamber if the GOP keeps Louisiana and Alaska in its column as expected.

Democrats had high hopes for Toomey’s challenger Katie McGinty — the two were in a dead heat leading up to Election Day in what was one of the most closely-watched Senate race in the country.

A victory for McGinty, a former environmental adviser in Bill Clinton’s administration, was critical to the Democrats’ strategy for retaking the Senate from Republicans. The Associated Press has called it the most expensive Senate race ever.

Toomey, a former congressman who was elected senator in 2010, drew criticism in the days leading up to the election for his refusal to say whether he would vote for Donald Trump. On Tuesday, about an hour before polls closed, Toomey revealed that he had voted for the Republican nominee after all.

McGinty made Toomey’s silence an issue, calling his decision to stay mum “spineless” and “the exact opposite of leadership.”

From the beginning, Toomey had to strike a delicate balance in Pennsylvania, which Hillary Clinton was projected to win in The Post’s analysis of polls.

Toomey attacked Clinton on the campaign trail and hammered McGinty over her support for the Democratic nominee, while at the same time running ads in the state that featured vice presidential candidate Tim Kaine complimenting Toomey’s work in the Senate.

McGinty and Democratic groups were relentless in their attempts to tie Toomey to Trump. One ad compared Toomey’s support for an abortion ban in Pennsylvania to Trump’s call for “punishment” against women who seek abortions in the event that they were restricted or outlawed.

After trailing in October, several polls showed McGinty with a slight edge in the week before Election Day.