Conan found out who the criminal was and put Sonoko to sleep. Through Sonoko, Conan explained that the criminal had actually but in the capsule they found floating in the drink and the poison in separately to make it look like the poison was but in 15 minutes before when it actually had been put in more recently. By looking at the video Ran took he showed that Sonoko had put her lemon tea right next the victim's and the criminal had put the poison in Sonoko's instead of the one the victim had been drinking. Proof of this was the fact that Sonoko's fingerprints were all over the can and 2 of the people that had touched the can did have their fingerprints on it.
The only 4 people that had been near the can after it was switch was Sonoko, Ran, Conan, and the groom, Toshihiko Takasugi. Sonoko and Ran had never touched the can after the switch and once they exclude Conan, Takasugi and the victim herself are the only people that could of poisoned the lemon tea. Then he explains how it couldn't of been the victim because there was no container to hold it in and drying agent found in the room. Those two things were needed to carry around sodium hydroxide, the poison used, because sodium hydroxide liquefies in a few minutes and the victim was in the room the whole time there would be no way to dispose of the container and drying agent outside in the hall where it was found. Therefore, the criminal was Toshihiko Takasugi.
The motive was that superintendent Matsumoto had crashed into a suspect's car 20 years ago, and Takasugi's mother and only direct relative got caught in the crash. Not seeing Takasugi's mom, Matsumoto told him to go away when he tried to tell him; 15 min later Takasugi's mom died on the street. Upon hearing this, Matsumoto admitted his share of guilt in the accident, but also added that once he learned about Takasugi's mother, he never forgave himself for inadvertedly killing her.
Takasugi was adopted by a rich family, and then destiny brought him back to Matsumoto and Sayuri. When he learned that his girlfriend was the superintendent's daughter, he was consumed by anger and bitterness, wanted to kill her to show the superintendent how much it hurt to lose someone he cared for. Kazumi Takenaka, however, slapped Takasugi and told him that Sayuri's first love was a boy who loved Lemon Tea and never forgot him after he moved away for undisclosed reasons. Once Sayuri started dating Takasugi and noticed he also drank Lemon Tea, she deduced what had happened in the past... therefore she did know that Takasugi was her lost first love, knew what he wanted to do to her, and willingly took the poison to atone for all the pain that transformed Takasugi from a kind boy to an embittered adult.
Later they were told that Sayuri's surgery was a success and that she was going to recover soon... even to the relief of Takasugi himself, who had genuinely repented from what he had done. He was given a light sentence due to Sayuri telling the judge about how she drank his poison voluntarily; three years later, Sayuri and Takasugi rekindled their relationship, and they got married for real.