As of now, you get XP from following actions:
- Soaking XP from lanes.
- Killing enemy heroes.
- Taking mercenary camps
- Destroying enemy forts and towers
Doing map objectives (not entirely sure, will confirm ASAP and edit answer)
- On Blackheart's Bay and Cursed Hollow, you won't get experience for picking up doubloons and paying and picking up tributes. Same goes for Dragon Shire as well, you won't get XP for controlling shrines or Dragon Knight.
- On Haunted Mines and Garden Terror, you will get XP for killing ghouls and shamblers.
The experience gained from each of these actions is not constant and is granulated for the purpose of preventing a snowballing effect; therefore it's not possible to tell an exact number on these XP sources. It depends on your level and enemy team's level.
Another XP related topic I would like to mention is about Murky: When Murky dies, he yields 1/4 of the XP of a regular hero if his egg is alive.
Leviathan has a post about XP gained from Murky and lanes if you want to see the full discussion.
As for what I recommend is try to get every fort before finishing the game, given that you are comfortably ahead of the enemy team. Longer games yield greater amounts of XP (I once lost a 41 min dragon shire with a friend, got 300k XP). Try to do merc camps when they are up, also take into account the timing and map objectives. And obviously, play with a friend.
Bonus: u/ticklemeozmo compiled a table of XP amounts related to in-game level to end game XP on reddit.
Edit: A reddit post compiled some data regarding how much xp you get from various actions. Here are some highlights from the post:
Buildings have set values for XP.
- First wall turrets 400xp
- Forts 800xp
- Second wall turrets 650xp
- Keeps 1300xp
Hero kills give a base level that is modified by being behind or in the lead.
I believe the base number is 300xp, being two levels down
gives a 100% to the underdog (600xp).
- Ranged: 60+2/min
- Caster: 62+1.8/min
- Melee: 70+1/min
For Mercenaries individual xp:
- Knight 'melee' 50+2/min
- Seige Giant 50+2/min
For objective creatures:
- Garden of Terror:
- Shamblers : 60+2/min
- Terrors: 350+12/min
- Blackhearts Bay Pirates: 49+1/min