After losing Teddy, grab his arm from the floor and wait for the light to switch off.
The light will then turn on at a different spot, most likely right in front of you. Head towards that light.
Major plot spoilers are revealed in this part of the game, so just keep heading towards the light until you return to the playhouse.
Once you're back at the playhouse, put the pink elephant inside the machine and turn the valve until it goes into the door with the rest of the memories.
Since Teddy isn't around anymore, approach the door and use Teddy's paw that you picked up earlier and put it inside the small hole under the door. It takes a while to load so wait for the door to open.
Crawl through the darkness and open the door. Once you open the door you'll be back in your bedroom and it's already morning.
Head into the hallway and down the stairs and head into the kitchen to watch a scene.
After passing through the kitchen go towards the door behind the island counter and you'll see the main door. Approach the main door and watch the ending.