In how many ways electron can gain energy? Are there other ways in which an electron can gain energy other than a photon? Like with heat or using sound energy
 A: Deppends fundamentally which level do you want to explore.
In mesoscopic physics we can treat the electron as a particle with mass and charge. Any electric field or gravitational field will exert some interaction on the electron. Therefore an electron can gain some energy via a photon interaction (EM force, therfor photons) or just placing it slightly higher in the gravitational field. Not with electrons, but with neutrons, some experiments have been made proving that gravity plays a rol at a quantum level.
At a microscopic level, at high energies we can neglect the gravitational interaction, the possible interactions for an electron to modify it energy are through electromagnetic interaction and weak interaction. Consider this twoo processes:
$$
e^-+\gamma(k_1)\rightarrow e^-+\gamma(k_2)\\
e^-+\bar{\nu}_e(E_1)\rightarrow W^-\rightarrow e^-+\bar{\nu}_e(E_2)
$$
with $k_1>k_2$ the frequency of the photon, and $E_1>E_2$ the energy of the anineutrino. In both cases the electron will gain some energy. All the process at the scale we know about fall into this to categories. For example via interaction with a positron (Bha-bha scattering $e^-+e^+\rightarrow e^-+e^+$) the elctron gains energy via exchange of a photon in low energies or a $Z$ boson at high energies.
Hypothetically, at much larger scales other interactions can arise at a quantum level. The only one it is being treated seriously is, again, gravity. Via exange of a graviton, the electron could gain energy ($e^-+g(k_1)\rightarrow e^-+g(k_2)$).
Summing up: An electron can gain energy by:


*

*Absorbing a photon (for example in an EM field) $\rightarrow$ EM interaction.

*Exchanging a photon with other particle (hiting a nucleus in movement) $\rightarrow$ EM interaction.

*Exchanging a W or Z boson with other particle (as an antineutrino or a positron $\rightarrow$ Weak interaction.

*By gravity, classical (in a gravitational field) or quantum (by exchanging a graviton).

