story
It should be possible in theory to match the energy density of gasoline. You'd need to come up with a battery chemistry which takes in oxygen when it discharges and produces oxygen when it charges. Effectively, reversible combustion (or fuel cells). It's a tough problem but I don't think there's anything that fundamentally prevents it in theory.
Going much beyond it probably requires a nuclear process. You can store energy in certain isotopes by bombarding them with x-rays or gamma rays of a precise frequency. Stored energy can then be released with a similar process. In theory, it's possible to build a battery that uses this approach. In practice... to call it a difficult engineering problem would be a severe understatement.
Fundamentally, non-nuclear energy storage is limited by the strength of chemical bonds. For combustion, you're taking chemical bonds of high potential energy, breaking them apart, and rearranging the atoms into molecules with chemical bonds of lower potential energy. The energy difference is the heat produced by the combustion. The situation is similar in batteries, but in addition to rearranging atoms, free electrons are also liberated or consumed, with the bond energy difference going into that. For something like a mechanical spring, the winding force distorts the chemical bonds without breaking them, treating them like extremely tiny springs, with the same principle of operation as the big one. In all cases, the chemical bond strength determines how much potential energy can be crammed into the system.
For example, Wikipedia claims that flywheel energy storage (a "battery" where you just spin a disc faster to put energy in, and use it to drive something to get energy out) tops out at about 400Wh/kg. Lithium-ion batteries top out around 250Wh/kg, somewhat similar. Gasoline has a vastly better energy density at around 12,000Wh/kg... but gasoline needs to react with oxygen to release that energy! In fact it needs to react in an approximately 4:1 ratio, so the total mass going into the reaction is 5x the mass of the gasoline alone, making for an energy density of about 2400Wh/kg. Still much higher than batteries, but not outlandishly higher. I believe the difference would be because it's much easier to turn strong chemical bonds with a lot of potential energy into heat than it is to turn it into electrical potential.
You can see how reacting with the air gets you a huge advantage when it comes to how much stuff you need to carry around with you to store any given quantity of energy. And you can also sort of see how they all end up hitting the same basic limitations in the end. If you want to go further, you need take advantage of a stronger force with more potential energy, like the strong nuclear force.
(Gravity would be another possibility. If you could store energy by raising and lowering the orbit of a heavy object orbiting close to the Sun, you could get a pretty high energy density. Or if you want to go more exotic, store energy in the rotation of a neutron star or black hole. These approaches, however, pose even more difficulty for adaptation to automobile propulsion than the nuclear option.)