While not exactly like your plans, these threads can be used as guidance in planning.
Transiting in NRT- arr 10:40, dep. 19:55 same day: time to visit downtown Tokyo?
Six hours in Tokyo -- recommendations?
23 hours in Tokyo- yes i've read the threads
In short you can lose 2-3hrs from touchdown-immigration/customs-+ doing various things such as currency exchange - then transportation into Tokyo.
6pm flight you want to start leaving Tokyo around 3pm, since on your return you have to go through various security checks, and exit immigration.
One plan idea is,
From Narita Airport you'd probably want to take the Keisei Skyliner to Nippori Station (or if you're budgeting, the Keisei Limited Express) Price 3000-6000 yen one way for 3 people)., where you want to change to the JR Lines to Akihabara Station where you can browse around at all the video games, computers and other electronics equipment.