Down-to-the-wire opinion polls yesterday showed President Reagan still headed for a solid victory, but there were indications that Walter F. Mondale may be closing the gap.

Reagan, confident but campaigning down to the "final whistle," made an unscheduled detour to Mondale's home state of Minnesota in the hope of sweeping all 50 states. Mondale, meanwhile, campaigned in Texas and later headed for California, still trying to bring home wavering Democratic voters.

A Washington Post-ABC News poll of 2,252 registered voters interviewed from Friday through yesterday showed Reagan leading Mondale, 54 percent to 40 percent, with 6 percent undecided, indicating that the race has drawn closer. A Post-ABC poll completed Thursday night showed Reagan with an 18-point lead.

The final Gallup pre-election poll taken Friday and Saturday showed Reagan leading Mondale 59 percent to 41 percent. The generic preference for congressional candidates showed 51 percent of Gallup's respondents indicating that they would vote for a Democrat for Congress, 49 percent preferring a Republican.

The latest Post-ABC poll also found a slight Democratic advantage in preferences for House hopefuls, but found a substantial number of undecided voters. Democrats were preferred by 47 percent of voters polled and Republicans by 45 percent, with 8 percent undecided.

Both the Post-ABC and Gallup findings raise the possibility that there may be substantial GOP gains in the House. Gallup said its findings suggest that the Republicans could win back the 26 House seats they lost in 1982, which would give them the hope of reconstituting the ideological working majority with conservative southerners that enabled them to pass Reagan's legislative program in his first two years.

The Democrats are hoping for a net gain of two to four seats in the Senate, which Republicans control 55 to 45. They hope to limit GOP House gains to 20 or less and keep the control they have maintained for two years.

The latest Harris poll indicated that a surge of women and black voters for Mondale put the Democratic presidential candidate within 12 percentage points of Reagan: 43 percent for Mondale, 55 percent for Reagan. The previous Harris poll showed Reagan leading by 16 points.

A poll by the Roper Organization, completed Saturday, showed Reagan leading Mondale 52.5 to 42.5 percent, with 5 percent undecided.

The latest Boston Herald poll, taken Thursday and Friday nights, showed a 5-point Mondale lead in Massachusetts, with 49 percent for Mondale, 44 percent for Reagan and 7 percent undecided. Mondale trailed Reagan 45 percent to 48 percent two weeks ago. Mondale was the choice of 68 percent of the Democratic respondents compared with 62 percent a week ago.

In Minnesota, The St. Paul Pioneer Press-Dispatch's Northstar poll indicated that Mondale was leading Reagan 45 percent to 41 percent, with 12 percent expressing no preference.

However, the latest Minnesota poll, published in the Minneapolis Star and Tribune yesterday, gave Reagan 49 percent and Mondale 44 percent, with 7 percent undecided.

In North Carolina, where Sen. Jesse Helms (R) and Gov. James B. Hunt Jr. (D) are in a tenacious fight for Helms' Senate seat, the latest Gallup poll had Reagan ahead, 62 percent to 35 percent with 3 percent undecided. In Ohio, a Columbus Dispatch poll showed Reagan leading with 60 percent to 40 percent, compared with a 16-point lead two weeks ago.

Reagan tailored his final campaign days to help other GOP candidates as well as go for the sweep.

From Minnesota, where he spoke in behalf of Republican Sen. Rudy Boschwitz, who has been in a tough reelection fight, Reagan doubled back to Chicago to make his second appearance in three days for Sen. Charles H. Percy, who is in one of the country's hardest reelection races.

Mondale went to Texas yesterday in an effort to stir the black and Hispanic vote and give a boost to Lloyd Doggett, the hard-pressed Democratic candidate there. He went on to California in an effort to crack Reagan's base in the Sun Belt and will return to his home in North Oaks, Minn., for election night. Reagan will watch the returns in California.