There is a striking sign that greets clubbers on the way in to Manchester's Warehouse Project – once they have ignored the big yellow amnesty box where they've been advised to post any illegal substances, and run the gauntlet of the club's 100 security staff and some eager sniffer dogs. "DRUGS", says the placard, yellow writing on a black background. "Just because you know your dealer doesn't mean your dealer knows what is in the drugs that he is selling. Please be safe!"

Watching 5,000 people stream into the UK's biggest nightclub, recently voted one of the top 20 clubs in the world by DJ magazine, boss Sacha Lord looks pensive. "Ever since the tragedy, I'm on edge," says Lord. "It's something that will never leave me."

His eyes dart as his head of security receives a torrent of abuse from one of the 38 punters refused entry at the door during the evening.

In a police van behind Lord, one pink-cheeked 22-year-old is under arrest after managing to get past the sniffer dogs with a little bag of cocaine and 10 tiny "bombs" of MDMA wrapped in cigarette papers, only to be caught when staff made him turn out his pockets.

The tragedy Lord was referring to happened on 27 September, the hotly awaited opening night of the Warehouse Project's annual three-month season, when a 30-year-old youth worker called Nick Bonnie died after taking drugs at the club. Four of his friends were also taken to hospital that evening. The following night, a suspected dealer was taken ill after swallowing 12 snap bags of drugs. He was joined in hospital by seven other clubbers, plus one woman who had to be put into an induced coma the following week.

Now the club is testing an innovative approach to preventing future deaths. Part forensic science and part public information, the scheme involves testing drugs that are circulating among clubbers in real time so that they can be warned on the night about potentially dangerous batches – including PMA, a nasty, newish drug sometimes mis-sold as ecstasy. PMA can kill at lower doses than ecstasy (especially when mixed with other drugs) and can rapidly cause a fatal rise in body temperature.

An increasing number of deaths in the UK have been linked to the drug. According to the Office for National Statistics, 20 people died after taking it in 2012, compared with just one annually in previous years. This year the north of England in particular has seen a sharp increase in suspected cases. Experts say no one intentionally buys PMA, but that it came into circulation masquerading as ecstasy when there was a global shortage a few years ago. An inquest into Bonnie's death has not yet taken place. But his symptoms – including a very high temperature – were consistent with ingestion of PMA.

The drug-testing pilot is run once a month at the Warehouse Project by Fiona Measham, professor of criminology at Durham University and the UK's foremost expert on club drug culture. It involves her and a colleague sitting in a freezing cabin outside the venue, testing drugs posted in the amnesty box or confiscated by security in and around the venue.

"There are no bubbling test tubes – just us and a testing kit," says Measham, who has titled her study The Triangulation of Social, Forensic and Toxicology Data at the Warehouse Project. If she finds anything particularly worrying, she can tell the club, which can put out warnings on social media and on an LED sign in the venue.

At around 4am, an hour before the club closes, Measham goes into the men's toilets with a big syringe and siphons off urine to see whether what clubbers think they've taken tallies with what they actually have. Results will not be published until next year, but she says early indications are that drugs are becoming purer, from a nadir in 2009-10 when she was testing pills and powders that contained not a grain of what they purported to be.

Mark Roberts, chief superintendent with the local Trafford police force, admits he was not overjoyed when he heard the Warehouse Project was upping sticks from its old location in the city centre to a site near the Old Trafford football ground in his district last year. "It was phone thefts we were worried about initially. There were a few test events around Easter 2012 and we were seeing as many as 60 phone thefts a night in the club. One night we caught a guy who was wearing long johns under his jeans and had 37 phones stashed down them. Another had 44 hidden inside a pair of cycling shorts under baggy trousers. That level of thefts is just not acceptable – logging each missing phone takes up a lot of police time."

Roberts was impressed with the club's response: they beefed up the undercover security team which roams the venue. Lord already paid for four Trafford police officers to patrol each weekend outside the venue.

He is pragmatic about drug use inside the club. "We have got to accept that venues like this attract a significant proportion of people who use recreational drugs. Clearly these drugs carry massive risks, but it's a fact of life."

Measham's drug research was already in the pipeline when Bonnie died. So was a much-disliked one-way system at the club designed to avoid crushes at peak times. But Bonnie's death cemented Lord's view that he had a duty to keep clubbers as safe as possible. He added 25 extra security staff, taking the tally to 101, some of whom – never the most popular – tour the dance floor in high-visibility jackets with powerful torches. He has installed extra air-conditioning units, improved lighting in the darker corners of the club, employed on-site medics and introduced a welfare area where anyone feeling unwell after taking drugs can seek advice without having to worry about being arrested. These extra measures, he claims, cost the club £32,000 every weekend – "an unsustainable amount".

Doesn't Lord worry about alienating his core crowd by being so actively anti-drugs? Apparently not. "We've not alienated our crowd. The tickets do the talking. We've sold 150,000 tickets this season in the space of three months. It's like when a tragedy happens at Glastonbury or somewhere, people don't think, 'Oh, I'm not going to go to that festival.'"

As his business partner Sam Kandel puts it: "I think everybody appreciates the spirit of our message, which is that when you go out, please be responsible."