I am a Maltese citizen, and I am visiting the USA currently by ESTA visa (visa waiver program), so I can't stay here more than three months, but I need to stay more because I have to spend more time with my uncle, whose wife passed away. I need to know if I can apply for a B1/B2 visa while in USA or from any other country near USA that allows me to stay more.
It is not possible to apply for a B2 visa whilst in the US - it must be done at a US Consulate outside of the US.
There is a process for extending a VWP stay by up to 30 days in the event of an "emergency". The process is described on the CBP website, and will involve contacting the nearest USCIS Field Office, which can be found on the USCIS website.
Depending on the exact situation it's very possible that this would not constitute an "emergency", but contacting the USCIS to request an extension doesn't have a downside so it's worth at least trying.