The present invention provides implantable medical devices for detecting phrenic nerve stimulation. A pacing module is configured to deliver pacing pulses having a predetermined pulse amplitude and/or width within the refractory period of the left ventricle. The pacing pulses are repeatedly delivered during a number of cardiac cycles, and the pacing pulses are delivered at different delays relative to an onset of the refractory period of the left ventricle in different cardiac cycles. An impedance measurement module is configured to measure impedance signals in time windows synchronized with the delivery of pacing pulses in the refractory period of the left ventricle. A phrenic nerve stimulation, PNS, detection module is configured to gather at least one impedance signal from each time window, create aggregated impedance signals using the impedance signals from the different time windows, and analyze the aggregated impedance signals to detect PNS.