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