Keyboard and Touchpad stopped working - MacBook Pro 15" - Mid 2009 Today after opening the lid I found out that TouchPad and Keyboard doesn't work. I tried with an external USB mouse, but no success. However, keys work during the startup when I'm trying PRAM reset. Booted in safe mode but again they froze at login screen. Recovery mode didn't work either. I just can't login into my mac.
My machine is MacBookPro 15" Mid 2009, running macOS Sierra. 

Update: Recovery mode doesn't work, it shows nothing, but I booted with Option key to select startup disk and both keyboard and touchpad work while choosing the startup disk. But once I got to the login screen, they both freeze.

Any hints what might be the problem and what other steps I should take before taking it to the repair shop?

Thank you very much!
First off, you are running macOS Sierra on on an unsupported Mac.  Per Apple's official supported hardware list, it supports MacBook Pros from 2010 and newer.

macOS Sierra was installed either by:


using some sort of "hack" to trick the installer into thinking it was supported hardware
installing it on a different MacBook Pro then moving drive with the new macOs installation into your MacBook Pro.


It's quite conceivable that this installation initially worked, but after an update, things would break because Apple is not anticipating that macOS Sierra is working on unsupported hardware.

The fact that it's working in a pre-boot environment, is a good sign that your hardware is good, though it's not conclusive.  What you need to do is to revert back to El Capitan (10.11.x).  

Run Internet Recovery CommandOptionR instead of booting from the Recovery partition.  This will load the last supported OS.  If your keyboard and trackpad works, then you have your answer.

What you will need to do next is to erase your drive and start with a fresh install of El Capitan.