People who live or work near takeaways eat more junk food and are almost twice as likely to be obese as those who have none on their doorstep, a study has found.

Consumers who are the most tempted by takeaways and fast food eat an extra 40g of high calorie food - the same as half a small serving of McDonald's fries - every week compared with those who stay away.

Working near a fast food place or takeaway caused the biggest problems, closely followed by them being located near the home.

The research, published online in the British Medical Journal (BMJ), is the first UK study to combine data from home, work and commuting and involved 5,442 adults from Cambridgeshire aged 29 to 62.

On average, people were exposed to 32 takeaway outlets - nine each in their local neighbourhood and on their commute, and 14 within a mile of work. There were around 48% more takeaway outlets and fast food joints near work compared to home, the study found.

Researchers examined how much takeaway food people ate using questionnaires for foods such as pizza, burgers, fried food (such as fried chicken) and chips.

They also measured people's body mass index (BMI) as a measure of their weight.

The results showed that people exposed to the highest number of takeaways were 80% more likely to be obese and 20% more likely to have a higher BMI than those with the lowest number of encounters. They also ate more of these types of foods.

The researchers said: "Compared with people least exposed to takeaway food outlets, we estimate those most exposed consumed an additional 5.7g per day of takeaway food, which would constitute a 15% higher consumption than those least exposed.

"In a week, this translates into an additional 39.9g of takeaway food. This weekly amount constitutes more than half a small serving of McDonald's french fries (typically 71g per serving)."

Dr Thomas Burgoine, lead author of the study from the UK's centre for diet and activity research, based in the Medical Research Council's epidemiology unit at the University of Cambridge, said: "The foods we eat away from home tend to be less healthy than the meals we prepare ourselves, so it is important to consider how exposure to food outlets selling these high calorie foods in our day-to-day environments might be influencing consumption.

"Our study provides new evidence that there is some kind of relationship between the number of takeaway food outlets we encounter, our consumption of these foods, and how much we weigh.

"Of course this is likely to be just one of a number of factors that contribute to a person's risk of developing obesity. However, our findings do suggest that taking steps to restrict takeaway outlets in our towns and cities, particularly around workplaces, may be one way of positively influencing our diet and health."

Professor Jill Pell, chairwoman of the Medical Research Council's population health sciences group, said: "To date, studies examining the link between the neighbourhood food environment and diet and body weight have provided mixed results, which is why it's important that we continue to study these relationships.

"In future this type of research will provide the robust evidence needed to develop effective strategies to tackle obesity and promote a healthier lifestyle."

Over the past decade, consumption of food outside the home has increased by 29%, while at the same time, the number of takeaway food outlets has increased dramatically, the researchers said. This, they argued, could be contributing to rising levels of overweight and obesity.

Tracy Parker, heart health dietitian at the British Heart Foundation (BHF), which helped fund the study, said: "We already know that people are spending more than ever on takeaways and food eaten away from home, and that these foods are often less healthy than the meals we make ourselves.

"This is a worrying trend given that a quarter of adults in the UK are already obese, putting them at greater risk of heart disease.

"While this study can't prove someone's local environment can cause them to become obese, it's vital we have the tools to make healthy choices when eating takeaways or food in a restaurant.

Dr Alison Tedstone, director of diet and obesity at Public Health England (PHE), welcomed the research.

She said: "Takeaway foods are popular and convenient but they tend to be high in salt, saturated fat and calories. Regularly consuming these types of foods may increase the risk of excess calorie intake, which leads to weight gain which increases your risk of some cancers, Type 2 diabetes and heart disease.

"PHE are working to help local authorities tackle the environmental causes of obesity. We have produced guidance on the regulation of takeaway fast food outlets which provides local authorities with recommendations such as using fast food outlet exclusion zones in school areas.

"PHE also provides a range of tips to make healthier choices easier when eating out and from takeaways."