First of all, you’ve chosen poor GPIO pins for your relay and PIR. Read this:
Secondly, you’re calling two functions at EXACTLY the same time:
I’m not sure why you don’t just combine these into one function. Also, you don’t need to re-read the value of the PIR Pin, you have its value stored in the global variable “val”.
Thirdly, are you sure that your relay is Active HIGH? most relays on the market seem to be Active LOW, meaning that they need a LOW command to activate the relay.
Pete.