I posted this on another question, not sure how to link it so adding again here..
I use 2009 iMac as an external monitor to my 2015 MBP.. all running latest supported OS as of today.
COMMAND-F2 on the iMac keyboard will toggle between the running iMac local display, and the Target Display Mode (TDM) when connected to my laptop via DisplayPort. TDM always starts out at 100% brightness when you switch to it.
COMMAND-F1 will adjust brightness lower until it goes completely dark. If that happens you need to switch back to iMac local display then return again to TDM which resets to 100%
Now the important part: COMMAND-F1 sometimes doesn't respond to lower the brightness. I found this seems to happen if local iMac screen is locked.. if I switch back to local iMac display and log in to the account to unlock it, then when I switch back to TDM, the brightness control will now respond.