atmega328p being powered through AREF!

I'm using an atmega328p in a standalone project.

I've discovered that when a voltage (5v) is being applied to the AREF pin, the microcontroller powers up and operates! In fact it, puts out a little over 3v on the Vcc pins.

Is there a way to prevent this?

you shouldn’t really be connecting a voltage to the AREF pin if you haven’t got an equal or higher voltage applied to AVCC and VCC - that goes for any IO pin!

Why exactly are you doing that??

I'm looking for a way to monitor the LiPo battery voltage without needing an extra IC.

The atmega is powered through a regulator as there are sensors on the board that require 3V. Hence, I thought of using the battery connected to AREF and comparing it to the 3V (via an analog pin). You're right though, on reading the data sheet, no pin should exceed AVCC/VCC +0.5V!

It's designed to have a very long standby time, so I'm loathe to use a resistor voltage divider to bring the voltage down (as it's always on!).

Any ideas?

Study the power control circuit of the Uno.

A P-channel FET can switch the battery positive to whatever (voltage divider) circuit you need, being switched on by an N-channel FET from ground which is enabled only when you need to take a measurement. CMOS logic is based on FETs which when switched off, pass no current either in the channel or the gate.