Can I put MacBookPro5,1 RAM in a MacBookPro5,2?
Both MBPs use the same RAM architecture: 204-pin PC3-8500 (1066MHz) DDR3 SO-DIMM.

Information from macOS app MacTracker.

8GB is the maximum supported RAM for this MBP.

Disclaimer: I'm a satisfied user of MacTracker and have no financial or other connection with the developer Ian Page.