Probably it is a combination of different reasons (presence of Saracens at Fraxinet, strong feudal government, competition from other trading cities - Genoa, Barcelon, Narbonne). IIRC the city declined very fast after the Carolingians and during the 10th century was quite destituted (by comparison, both Genoa and Pisa prospered during the 10th century, and at the beginning of the 11th they were already trading and raiding in the Levant and North Africa). In a way the fate of Marseille is similar to what happened to Amalfi: even before the consolidation of the kingdom of Sicily the free comune had to submit to the princes of Salerno; however Amalfi at least had a short time in the sun, Marseille did not: this is quite surprising.
It is not easy to find a solution: out of the top of my mind, an alliance with Genoa appears the easiest way (it would not be an alliance of equals, though); the alternative might be playing Provence against Anjou against Toulose and flirting with Barcelon/Aragon and Genoa. The latter would be a very risky game, and Marseille might very easily end up crushed and sacked.
If they find a way to gain at least a measure of independence, trading with the Levant is still an option. A participation to the crusades (as an embarkation port and the supplier of ships) would also be a possibility. IMHO trade with north Africa only would not be enough.
In the end I would believe that Marseille will become part of a larger state, be it Provence or France (or even a renewed kingdom of Arles in the HRE): the city does not have natural defenses such as to support a bid for independence nor the population to try and conquest inland.
You may want to check Tuscan Sons, a TL written by Shadow Knight and to which I contributed. In it Marseille is a free comune and has underwritten the Lesser Pact among the free cities and the HRE (or better the count palatine of Italy). The focus is not on Marseille, though.
The first voyage to the Cape was in 1470s (Bartolomeu Dias). Vasco de Gama had his 1st trip to India and back in 1497.