Midway was a distraction at a critical moment in the battle, but this more due to luck than anything else. If you replay the Battle Of Midway over again, it is unlikely it would have turned out that way again. Despite the US advantage of surprise and Japanese overconfidence, so much of the battle was down to luck.
Midway made three important (I won't say major) contributions to the battle. The first was to be a known target. The second was scouting. The third was to be a distraction at just the right moment. The actual combat performance of Midway's aircraft had only a minor contribution.
Without Midway, the US fleet would not have known where the Japanese carriers would be.
The Japanese wanted to lure the US carrier fleet, the US Navy's only major offensive capability, into a decisive battle. Midway was chosen as being far enough away from Pearl Harbor to be outside of land-based air attack, but close enough to be a potential threat to Pearl Harbor. The US would have to respond to the invasion and the Japanese would be waiting.
The elaborate Japanese plan of feints and ruses was eavesdropped on by US code breakers who realized Midway was the target. This allowed Midway to be heavily reinforced and the US fleet to be waiting.
During the actual battle, scouting was Midway's most critical contribution, but resulted in a bad decision that happened to work out by luck.
Midway had dedicated PBY scout planes as well as long range heavy bombers. The night before a PBY spotted the Japanese Occupation Force (not the carriers) 500 miles away. The subsequent attack did little, but it did confirm to the Americans that the Japanese had arrived on time.
At 5:34 early morning of the battle, a Midway based PBY spotted the Japanese carriers. Though at extreme range, this allowed the US carriers to attack first. The Japanese did not spot the US carriers until two hours later, the plane spotting for that sector happened to take off late.
However, rather than taking the time (and fuel) to form up and conduct the coordinated attack required against the elite Japanese navy, the US aircraft were thrown at the enemy with no plan. This resulted in a piecemeal attack with aircraft getting lost and bombers being separated from their fighters. The professional Japanese cut them to ribbons. Only through luck did the American dive bombers happen to arrive at just the right time to take advantage of the slaughter while the Japanese fighter screen was down low destroying American torpedo bombers.
While Midway allowed an early attack, the rushed attack should have failed. Spotting the Japanese carriers later would have resulted in a better coordinated attack with a better chance to succeed.
Just when the US carriers were spotted, the Japanese were busy recovering the first raid on Midway and preparing for the second. This was Midway's critical contribution.
Midway was far better defended than the Japanese anticipated (which should have tipped them off that something was wrong), and they had been attacked (ineffectively) by land-based Midway bombers. This convinced the Japanese that a second strike was necessary. Just as they were about to recover the first strike force and preparing the reserves for a second strike, the American carriers were spotted.
While the Americans decided to strike with whatever was on hand, the Japanese did not. It was decided to take the time to recover the Midway strike force, rearm for anti-ship work, and launch a full strike. This had two consequences.
Had the Japanese attacked immediately, their full strike force would have been on the way to the US carriers even as three of their four carriers were being sunk. This may have resulted in heavier losses for the US and the probable loss of the Midway Islands (the Japanese had a fleet of battleships in reserve). Even so, a tactical stalemate would have still been a strategic victory for the US: the US could replace air crews and carriers, the Japanese could not.
The other consequence was at the moment the US dive bombers attacked, the Japanese carriers were busy fueling and arming aircraft. The effect of the relatively few US bomb hits (Akagi was only hit by one) were greatly magnified by hangers and decks full of ammunition and fuel. Fires raged out of control and secondary explosions did considerably more damage than the bombs themselves. Lax Japanese damage control also helped the situation along.
Again, the timing was down to luck. Had the US attack arrived an hour earlier or later, Midway would have provided no advantage. Had the scout plane which spotted the carriers taken off on time the Japanese would have been prepared and Midway would have provided no advantage.
Had the Japanese not been so overconfident and so sure of their deception plan, Midway's heavy defenses should have tipped them off that something was wrong with their plan. With a more alert Japanese commander, Midway might have been a detriment.
As for the actual combat performance of Midway, their aircraft did very little. Their beefed up AA defenses did more, but were ultimately irrelevant.
The land-based bombers hit nothing. At this stage of the war, the US still believed that high level bombing of naval targets could be effective. It wasn't. They did help by inadvertently acting as scouts early in the battle and by attacking so ferociously to convince the Japanese that a second strike was necessary.
Midway had only 28 fighters, mostly woefully obsolete Brewster Buffaloes, and were wiped out in the first attack. They shot down a few aircraft.
Midway had very heavy anti-air defenses, recently beefed up in anticipation of a battle. In the first attack, the Japanese lost 11 aircraft with 14 heavily damaged, and 29 more lightly damaged. This might seem like a lot, but the Japanese had 248 aircraft. Most were lost without even being launched in the first US carrier strike that sunk three of the four carriers.
One thing to realize is that carrier operations are restricted not by the number of planes available, but by the ability to get them on and off the ship. Due to their straight deck and very crowded hangers, a WWII carrier cannot launch a strike while recovering aircraft and vice versa. While launching a strike, the aircraft waiting to launch will be sitting on the deck as illustrated here waiting to be catapulted off by the two, slow to recover, steam catapults. Post WWII, larger carriers and angled flight decks allowed planes to be launched and recovered at the same time.
In addition to launching and recovering strikes, there is the routine launching and recovery of scouts and Combat Air Patrol (CAP). A typical CAP at this stage of the war was just six fighters. The rest were held in reserve, under maintenance, or being refueled and rearmed to relieve the CAP.
So while Midway definitely played a part in the battle, the effects were mostly down to luck. Replay the battle again, change a few very minor factors like timing, and Midway's effect would have been even less.