Leading 1-0 from the first leg, the Blues had to defend for most of the game rarely getting a chance to grab a vital away goal, but they can feel proud of their efforts against a full time outfit.
Before the game, there was a minute of silence as a mark of respect for former Linfield chairman Billy McCoubrey who sadly passed away on Thursday morning.
AIK were intent in putting the Blues under pressure from the start and Jonathan Tuffey made his first save on 20 minutes when he did well to keep out an effort from Bahoui.
There was a narrow escape soon after when a relieved Linfield defence cleared the ball off the line following a corner. Warren Feeney's side toiled hard in the Stockholm heat but had only one effort on goal in the first 45 minutes when Aaron Burns saw his shot saved.
It was still all to play for in the second half and despite going behind on 55 minutes, Linfield only needed a goal to put them back in the driving seat.
However, it was AIK who sealed their place in the next round with a second goal on 72 minutes, Goltom drilling a low shot past Tuffey.
So close, yet so far for a battling Blues but a fine effort against tough opponents.
Linfield: Jonny Tuffey, Jamie Richards, Chris Hegarty (c), Andy Waterworth, Stephen Lowry, Michael Carvill, Aaron Burns, Sean Ward, Matthew Clarke, Reece Glendinning, Ivan Sproule.
Subs: Ross Glendinning, Mark Haughey, Jimmy Callacher, Peter Thompson, Jamie Mulgrew, Niall Quinn, Ross Clarke.