Boyle began confidently, pushing past early leader Elena Sokolova of Russia by the 200m mark and working her way to a handy advantage after 300m. As the Russian faded, 200m specialists Melanie Costa Schmid (ESP) and Chloe Sutton (USA) started to turn up the pace.
The Kiwi led by more than a second with 50m remaining but the two sprinters powered home to tip Boyle for a second gold by the blink of the eye.
Boyle's time of 4:01.24 bettered her own New Zealand record she set yesterday during the 800m final.
"I didn't actually realise how close it was until I looked at the result,'' Boyle said. "The last 100m wasn't really good tonight but I am really stoked to be on the podium again. It's a good result, but there are always things to work on.
"It was a pretty hard back-up because the 800 takes a bit out of you. It was quite a short turnaround to the heats for the 400. But it's been a good day -and-a-half of hard racing. I am looking forward to a day off tomorrow.''
Boyle will tackle the 200m freestyle along with Ingram on the final day.
"For the 200, my final will be the heat because my 200 is not one of my stronger events so I will have to swim really well to get a second swim.''
Stanley, 20, proved he will be a key member of New Zealand swimming's push towards Rio with a strong performance in the 400m freestyle.
He swam faster with each outing in Istanbul, lowering his entry time of 3:42.17 to 3:41.59 in the heats and he cut a further half second off that time in the final to 3:41.01.
But the London Olympian was disappointed and believed a medal was in his grasp today.
"Fourth is like first loser,'' Stanley said. "I wish I had backed myself a little more and I could have come away with a medal, maybe.
"I didn't have the easy speed I needed through the first part of the race and I wasted a bit of energy and went out a little bit slow, which was a shame.''
His best is 3:40.74, when he won the recent World Cup event in Beijing and he now begins to circle on another Danyon Loader national record of 3:40.46, which broke the world record at the time, set in 1995.
Ingram turned in another strong effort in a packed field with similar heat times. She made her trademark conservative start and powered home in 2:05.45 for sixth in the race won by Ukraine's Daryna Zavina, who battled with the Kiwi in the recent World Cup series.
Ingram got the better of Zavina with five wins in that series but the 27-year-old said it was probably her undoing tonight.
"The experience of the World Cup racing was beneficial in terms of how to execute a race plans. Unfortunately, tonight I didn't have the back-end speed I needed which was a reflection that I hadn't done the training I needed in the build-up because of all the racing.
"I knew it would be a risk but decided to do the World Cup and, while the experience was great, it didn't quite work for this. You learn from it and move on.''
Earlier Howick Pakuranga's Ewan Jackson was 22nd fastest in the heats in 3:46.00.
Tomorrow is a quiet day for the New Zealand team with Stanley and Cameron Simpson in action in the 100m freestyle. Boyle and Ingram return on the final day for the 200m freestyle, Corey Main goes in the 200m backstroke and Stanley competes in the 1500m freestyle.