The funding, which will go to the tissue bank at Imperial College London, will help scientists from across the globe access brains digitally, which the charities hope will make research easier.
The bank is already the largest repository of brain and spinal cord tissue in Europe, and has shared 100,000 samples with scientists over its 20-year lifespan.
The charities are contributing £1.54m each over the next five years.
The tissue bank will also have a 3D interactive section to allow people to explore a virtual brain, which the charities hope will help potential donors understand how the bank works and what happens to donated tissue.
Other research will look at how genetics affect the development of MS or Parkinson’s, and the bank will try to link genetic information to tissue samples.
Dr Sorrel Bickley, head of biomedical research at the MS Society, said: "The MS Society tissue bank has been vital in improving our understanding of MS and finding treatments for some people with the condition. But our top priority now is finding treatments to slow or stop MS for everyone.
"We can see a future where nobody needs to worry about MS getting worse, but for that to happen we urgently need to find treatments that repair myelin – the protective layer that surrounds our nerves, which is damaged in MS – stop inflammation in the brain and protect nerves from damage. This funding will allow researchers to operate as effectively as possible and help us stop MS faster."
Professor David Dexter, deputy director of research at Parkinson’s UK, said: "This holds huge potential for speeding up access to better treatments and ultimately a cure for the 148,000 people with Parkinson’s in the UK.
"In addition to providing tissue to researchers worldwide, this project will now also give them access to an immense library of tissue images that can be studied indefinitely."