The past tense of gain mastery over is gained mastery over.
The third-person singular simple present indicative form of gain mastery over is gains mastery over.
The present participle of gain mastery over is gaining mastery over.
The past participle of gain mastery over is gained mastery over.