see also
AHC: Have the Roman Republic Last
JoshuaTheRoman
AHC: Save the Roman Republic
Elcheapodeca
Yet Another 'Save the Roman Republic' Thread
DominusNovus
I'm sure there's more, the search I tried only went back a couple of years.
Basically, once you started having successful generals able to take over the state, it becomes really difficult to keep that from happening again.
At minimum, you'd need to
1) provide governmental support for retired soldiers, as opposed to generals providing their own soldiers with loot and land. How you do that is tricky. How can you possibly convince soldiers that the loot they gain is due to the beneficient State, not to the general that conquered new territory and provided the opportunities for loot. Basically, you might have to severely clamp down on Roman expansion, so there aren't many opportunities to gain that loot.
2) probably fix the tax-farming/exploitation of the provinces. If governors appointed to Asia, for instance, can reasonably expect to squeeze enough money out of their province to be able to buy massive power in Rome, it's going to severely impact viability of the Republic.
3) There's a huge amount of reform that needs to happen. An Emperor, ruling by decree, is equally authoritarian over all the Empire (in principle). A (somewhat vague) democracy where the only voters are in the City of Rome is guaranteed to increase the us-versus-them mentality of everyone who's supposedly equally 'Roman'.
These are minimal requirements. How to get any of them, is very difficult. How to get all, I have no clue.