Gain = to obtain or secure something desirable.
Gain also = to increase the rate of something "a car gains speed accelerates away from a starting position"
Gain also = the increases in power applied to electrical circuits.
Earn = obtain money usually from employment or by your labours/labors or services to others.
Earn also= to obtain someones gratitude or respect from/by the actions you have shown towards them
Earn also can be used to mean the same as gain when investing money, for interest on a bank account we say "earn interest"
Win = to overcome be successful in a contest.
Win = can sometimes be used to describe earning a salary
So the situations when one word must be used are as indicated above. But for winning. gaining, earning in a competitive employment environment there can be some overlap and a little interchangeability.
"after what he did for me last year he has earned my utmost respect" is most correct
"after what he did for me last year he has gained my utmost respect" = is used but not the most appropriate word following the dictionary definition [people will disagree]
"after what he did for me last year he has won my utmost respect" = is used but not the most appropriate word following the dictionary definition [people will disagree]
It is best you practice writing sentences and seek corrections.