The EU Medicines Directive (whose agency is located in London) is responsible for regulating clinical trials and the safety of all medicines in the EU. Ben Goldacre (Bad Pharma, etc) has had a hand in the formulation of its standards.
NICE and the NHS have the ultimate say in which drugs are prescribed, but the Directive means that medical research companies have to follow strict guidelines.
Withdrawing from the EU would mean that the UK would have to set its own guidelines.
Critics of the Directive claim that the big pharma companies can afford lobbyists, which is true, but the new guidelines mean that the companies (even the big ones) have to follow stricter guidelines, which means we all have safer drugs.
A few weeks ago, a certain poster on GN posted a link to a small company, which claimed that the EU was blocking an important cancer drug. It turned out that the company was completely unlicensed, was selling small phials of an untested drug for £500 to desperate people and the company was being investigated for financial fraud. The EU Directive tries to protect patients from such snake oil salespeople.