Experts have ruled drugs used to treat schizophrenia should not be given to elderly patients with dementia.
The antipsychotic drugs risperidone and olanzapine are used to control behavioural problems.
But the Committee on Safety of Medicines said patients with dementia were three times more likely to have a stroke if they were taking the drugs.
The CSM estimated that around 40,000 over-65s were prescribed the drugs last year.
Around 30,000 were given risperidone, and 9,000 olanzapine.
Both drugs are atypical antipsychotics, which are also used to treat agitation, anxiety, mania and aggression.
Some doctors prescribed the drugs for patients with dementia, even though they were not specifically licensed for that use, if they believed they could help the individual patient.
But there has been concern that antipsychotics were being inappropriately used as a so-called 'chemical-cosh' to control patients.
Experts have now said the evidence linking the medications to increased stroke risk means they should not be prescribed for patients with dementia.
They said many patients' conditions could be managed without drugs, and there were other alternatives for those who needed medication.
Professor Gordon Duff, chairman of the CSM, said: "Atypical antipsychotic drugs are an effective way of managing a range of conditions and have a good safety record.
"The advice issued today relates only to two specific atypical anti-psychotic drugs being used to treat behavioural symptoms for dementia.
"Other patients using this type of drug to manage other conditions are not affected."
He added: "Treatment should only be stopped on the advice of a doctor.
"Where elderly patients with dementia are receiving one of these drugs, carers should arrange for the doctor to review treatment as soon as practical within the next few weeks."
Sir Alasdair Breckenbridge, chair of Medicines and Healthcare products Regulatory Authority, added: "Antipsychotics are not licensed for the treatment of behavioural problems in dementia but we know they are used in these patients outside their licensed indications where prescribers make a judgement on their own responsibility that it is the right treatment for a particular patient.
"Many patients who suffer from dementia can be managed without medicines and for those who do need drug treatment, there are a variety of alternatives available."
Professor Clive Ballard, director of research at the UK's Alzheimer's Society, said: "The Alzheimer's Society sees this as an important opportunity to improve the treatment of people with dementia.
"People with dementia are too frequently given powerful sedative and antipsychotic drugs."
He said he was concerned such drugs were being overused, particularly in residential and nursing homes.
"In some areas of the country more than 40 per cent of residents with dementia are prescribed these treatments."
Paul Burstow, Liberal Democrat health spokesman, said: "This new advice underlines the need for active medicine management in the care of older people.
"The over medication of older people amounts to abuse. It can result in death and it denies older people their dignity.
"There needs to be much better monitoring of whether these drugs are being used for the benefit of patients or of staff."
The Chief Medical Officer will issue the revised prescribing advice to doctors.
The MHRA's website will also publish information for patients and doctors.
New guidelines on how dementia should be managed are also being developed by experts.