Olympiacos secured progression into the Europa League knockout stages at AC Milan's expense thanks to a 3-1 victory in Athens.